Forget slots (https://elfsternberg.com/2009/07/06/python-what-the-hell-is-a-slot/ …), what the hell is a dict? class Evil: __dict__ = None def __init__(self, x, y): self.x = x self.y = y >>> e = Evil(2,3) >>> dir(e) ... stare at it closely ... >>> e.__dict__ >>> e.x 2 >>> e.z ='wat' >>>
-
-
>>> class E: ... __dict__ = { 'x': 1 } ... x = 2 ... def __init__(self): ... self.x = 3 ... self.__dict__ = { 'x': 4 } ... >>> e = E() >>> e.x 3 >>> e.__dict__['x'] 4 >>> E.x 2 >>> E.__dict__['x'] 2 >>> del e.__dict__ >>> e.__dict__['x'] 1
Show this thread -
Ok. Enough frivolity for now. BTW: You can't spell "Enterprise" without "E".
Show this thread
End of conversation
New conversation -
-
-
class Evil: __dict__ = True def __init__(self, x, y): self.x = x self.y = y >>>> e = Evil(2,3) >>>> e.__class__.__dict__ == Evil.__class__.__dict__ False >>>> e.__class__.__dict__ is Evil.__dict__ False >>>> e.__class__.__dict__ is True False >>>> e.__dict__ is True True
-
does this mean the instance __dict__ is a descriptor err... object? i just rewatched your metaclass video a few days ago & my brain is still scrambled i think
-
ah shit yeah mappingproxy, nm
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.