I'm sure this is a duplicate, but I can't track it down at the moment.
In this example, why is self
not defined?
class State(Enum):
MY_STATE = type(self)('foo', 'bar')
def __init__(self, some, thing):
self.some = some
self.thing = thing
Replacing type(self)
with State
also returns a NameError
but for State
.