is there improved proceed named array constants (enumeration) python?
just looking during ways removing named constants python.
class constant_list:
(a_constant, b_constant, c_constant) = range(3)
then impetus ascribe so:
constant_list.a_constant
i suspect dictionary, controlling strings:
constant_dic = {
"a_constant" : 1,
"b_constant" : 2,
"c_constant" : 3,}
and ascribe this:
constant_dic["a_constant"]
my question, then, simple. there any improved ways doing this? observant unsound anything, only extraordinary - any common idioms i've missed?
thanks advance.
Comments
Post a Comment