is it possible in python to address class variables from other class variables within the same class?
My problem is: I am trying to prepare some static code, that would look like this:
class MyBaseObject:
SIGNAL_NAME_1 = "signal-name-1"
SIGNAL_NAME_2 = "signal-name-2"
ALL_SIGNALS = {
SIGNAL_NAME_1: ( signal-definition ),
SIGNAL_NAME_2: ( signal-definition ) }
My problem with the above is that, according to python SIGNAL_NAME_1
and _2
are not defined while creating dict. Accessing them by MyBaseObject.SIGNAL_NAME_1
also does not work (unknown object).
So question is - is it possible to have class variables referring to one another in python?
Thank you!