__metaclass__ and __author__ are already decorators
pm_mon at yahoo.com
Sat Aug 21 20:31:15 CEST 2004
Paolo Veronelli wrote:
> Paul Morrow wrote:
>> Thinking about decorators, and looking at what we are already doing in
>> our Python code, it seems that __metaclass__, __author__, __version__,
>> etc. are all examples of decorators. So we already have a decorator
>> syntax. What is the compelling reason to invent a new one? And if we
>> do, what's to become of the old one?
> You are right ,if some __xxx__ (only __metaclass__ for now?) class
> attributes have deep meanings (not only a syntactical
> one(__lt__,__getitem__,....)) ,and many people suggest not to use them
> (probably there is something about a non pythonicity of __metaclass__
> in this behaviour) then it would be very nice to match this deepness
> against the decorator one ,at least using @
> before class definitions if it's the case....
> Thanks for pointing out another unpythonicity. Paolino
Is that what I did? Isn't assigning values to __xxx__ attributes
pythonic? I see it all over the place. pydoc uses it. It's how we
declare metaclasses. It's how we enable special operators and special
behavior. It's how we specify meta information (author, version,
credits, etc.). The @ on the other hand...
More information about the Python-list