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

Aahz aahz at pythoncraft.com
Wed Mar 10 10:31:26 EST 2004


On Wed, Mar 10, 2004, Guido van Rossum wrote:
>Aahz:
>>Someone:
>>>
>>> I'd be very surprised if the interpreter cared that a decorator
>>> returned a callable; what should it care?
>> 
>> The interpreter doesn't care; *people* care.  That's precisely why it
>> should be a documented requirement.
> 
> So decorators couldn't be used to create read-only properties?

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.

Also, I thought we had explicitly punted on allowing decorators to create
properties because the syntax wasn't sufficiently flexible without
contortions.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Do not taunt happy fun for loops. Do not change lists you are looping over."
--Remco Gerlich, comp.lang.python



More information about the Python-Dev mailing list