[Python-Dev] Re: new syntax for wrapping (PEP 318)

Thomas Heller theller at python.net
Thu Feb 26 13:48:04 EST 2004


Christian Tismer <tismer at stackless.com> writes:

> Bob Ippolito wrote:
>
>>> class klass:
>>>   foo = decorator
>>>   def foo():...
>>>
>>>   baz = decorator1, decorator2
>>>   def baz(): ...
>>>
>>> The simple idea is to change semantics that if a name already
>>> exists before a def, it is checked whether it is a decorator
>>> function or a tuple of these, and if so, they are called.
>
>> That's too magical for me, and it means I have to spell out the name
>> of the function (which may be quite long) twice.. which is better
>> than three times, but not as good as once.
>
> Or even simpler, just push them as special constants on top of the def:
>
> class klass:
>    classmethod
>    def foo():...
>
> not too serious, but I hate new syntax...


The above code looks like as someone forgot to actually initialize the
class variable (probably not too likely with the name 'classmethod', but
with other names):

class klass:
   classmethod = 42
   def foo():...

Thomas




More information about the Python-Dev mailing list