__metaclass__ and __author__ are already decorators

Leif K-Brooks eurleif at ecritters.biz
Sat Aug 21 21:06:02 EDT 2004


Paul Morrow wrote:
> Leif K-Brooks wrote:
> 
>> Paul Morrow wrote:
>>
>>> So when we define an __xxx__ attribute inside of a function, we are 
>>> trying to make a statement about the function --- we are not trying 
>>> to create a local variable.  Therefore the Python system shouldn't 
>>> create a local variable in this case; it should create a function 
>>> variable instead (IMO).
>>
>> How do you think a newbie will react to magic behavior like that from 
>> the assignment operator based entirely on the name being assigned to?
> 
> We must emphasize that they are assigning to a 'magic' variable, as all 
> __xxx__ attributes are supposed to be.  One must be careful with magic :-)

I'm starting to reconsider whether I like your proposal. My first 
reaction was against it, since it seems like Perl-style magic behavior, 
but now I'm not sure. It definitely is magic, but its purpose seems much 
more clear than a lot of the other decorator proposals; that's what 
Python is all about.



More information about the Python-list mailing list