[Python-Dev] PEP 318 - generality of list; restrictions on elements

Phillip J. Eby pje at telecommunity.com
Wed Mar 10 11:10:21 EST 2004


At 10:31 AM 3/10/04 -0500, Aahz wrote:
>Maybe I'm misunderstanding something.  I thought that a property contains
>a get descriptor, which makes it a kind of callable.  Read-only
>properties contain a set descriptor that either does nothing or raises an
>exception.  That doesn't affect whether the property is classified as a
>callable.

Properties are not callable.

Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
 >>> x=property()
 >>> x()
Traceback (most recent call last):
   File "<pyshell#1>", line 1, in ?
     x()
TypeError: 'property' object is not callable
 >>> callable(property())
0
 >>> callable(property(lambda x:None))
0
 >>>





More information about the Python-Dev mailing list