In 2.2 I was able to call object.__setattr__(cls,attr,value) where cls is a new-style type (first argument of a classmethod), and attr and value are the name and value of a class attribute I want to create programmatically. I just upgraded to 2.3 but now when I try it I get >>> class foo(object):pass ... >>> object.__setattr__(foo,'foo',None) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: can't apply this __setattr__ to type object Instead I apparently have to call >>> type(foo).__setattr__(foo,'foo',None) Anyway, my question: no harm done here because this was in undeployed code and I've found a workaround, but shouldn't this have at least been mentioned in "What's New in Python 2.3"? Or maybe this is one of the some-other-change-with-far-reaching-consequences things that was mentioned and I just don't see the connection? -- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science
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