Computer science: Python: user-defined constants

Self-tutoring about Python: the tutor mentions constants.

To my knowledge, Python doesn’t have user-defined constants. However, there is a way to accomplish a similar impression: a namespace.

A namespace, in this case, is a separate file wherein the constant is defined. Let’s imagine the constant is called CONST0, defined in file0.py.

To an external file, CONST0 is now referred to by file0.CONST0 and so is virtually impossible to redefine by accident.

Source:

programiz.com

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply