I guess the rule is that you can only assign __class__ for classic class instances and the new value has to be a classic class also (ignoring C-written metaclasses, etc.). So __dynamic__ doesn't come into play. Still seems like the error message is a bit confusing. >>>>>>>>>>>>>>>>>>>. The following seems like it could use a more helpful error message. Presumably it fails because you can only set the value of __class__ to that of another class object whose __dynamic__ attribute == 1? C:\>python Python 2.2a1 (#21, Jul 18 2001, 04:25:46) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> class C(object): pass ... >>> class D: pass ... >>> class E: pass ... >>> d = D() >>> d.__class__ = E >>> d.__class__ = C Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: __class__ must be set to a class >>> Jim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4