Since we're talking about class decorators, I have a question about function and instancemethod objects. The following code works class Root(object): def index(self): return "Hello World!" index.exposed = True but this code class Root(object): def index(self): return "Hello World!" index.exposed = True gives the following exception Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'instancemethod' object has no attribute 'exposed' I can tell that instancemethods can't have attributes added to them outside of their class definition. Is this part of the Python language spec, or just an implementation detail of CPython? I bring this up here because it makes writing certain class decorators much more annoying. For example, if I want to write a class decorator that will set "exposed=True" for every method of a class, I must resort to shenanigans. - Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20080108/aafbc326/attachment.htm
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