python constants code example
Example 1: delcare consatnt python
Example 2: how to define a constant in python
You can't define a constant in Python unlike in other language, hence you can
just make the variable all CAPS and add a comment using '#' saying that this is
a constant variable.
Example 3: python cmath constants
cmath.e Returns Euler's number (2.7182...)
cmath.inf Returns a floating-point positive infinity value
cmath.infj Returns a complex infinity value
cmath.nan Returns floating-point NaN (Not a Number) value
cmath.nanj Returns coplext NaN (Not a Number) value
cmath.pi Returns PI (3.1415...)
cmath.tau Returns tau (6.2831...)
Example 4: python constant
class CONST(object):
__slots__ = ()
FOO = 1234
CONST = CONST()
print(CONST.FOO)
CONST.FOO = 4321
CONST.BAR = 5678