The whatsnew document states that descriptors have an
attribute __name__:
"""
Attribute descriptors are objects that live inside
class objects, and have a few attributes of their own:
* __name__ is the attribute's name.
"""
http://www.python.org/doc/2.2.1/whatsnew/sect-rellinks.html#SECTION000320000000000000000
But in real-world tests with Python 2.2.1 on Win32:
>>> class a( object ):
... b = property( )
...
>>> a.b.__name__
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'property' object has no attribute
'__name__'
>>>
Now, of course, the __name__ attribute wouldn't be that
useful, given that the descriptor could be
multiply-referenced under different names, but I'd
guess either the value should be present, or it should
not be in the whatsnew documentation. Would likely
need to be handled via a mechanism similar to
bound-and-unbound methods to make the __name__
attribute useful.
Enjoy,
Mike
|