Gordon McMillan wrote: > > I don't see anything here but an argument that allowing > attributes on function objects makes them vaguely similar to > instance objects. To the extent that I can agree with that, I fail > to see any harm in it. > To the extent it encourages confusion, I think it sucks. >>> def this(): ... sucks = "no" ... >>> this.sucks = "yes" >>> >>> print this.sucks 'yes' Why on earth 'sucks' is not the object defined in the function's namespace? Who made that deliberate decision? Clearly 'this' defines a new namespace, so it'll be also legitimate to get a NameError, or to: >>> print this.sucks 'no' Don't you think? And don't explain to me that this is because there's a code object, different from the function object, which is compiled at the function's definition, then assotiated with the function object, blah, blah, blah... -- Vladimir MARANGOZOV | Vladimir.Marangozov@inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252
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