[Python-Dev] Re: PEP 318: Decorators last before colon

Bob Ippolito bob at redivi.com
Thu Apr 1 18:02:44 EST 2004


On Apr 1, 2004, at 5:25 PM, David Abrahams wrote:

> Jeremy Hylton <jeremy at alum.mit.edu> writes:
>
>> On Thu, 2004-04-01 at 07:13, Michael Hudson wrote:
>>>> I don't think Michel is saying they are worthless.  However, the
>>>> proposed syntax is highly contentious.  It would be good if there
>>>> was a short term solution that wouldn't require new syntax.  That
>>>> would give Guido and the Python community time to figure out the
>>>> best syntax.
>>>
>>> We've been discussing this off and on for OVER A YEAR!  If 'the best
>>> syntax' hasn't been figured out yet after N thousand emails on the
>>> subject, I see no reason to believe enlightenment is going to arrive
>>> soon (or ever).
>>
>> There's no particular reason to believe that effort alone will arrive 
>> at
>> an elegant solution.  On the other hand, maybe there isn't a good 
>> syntax
>> for arbitrary decorators.
>
> Has something along these lines been discussed?
>
>   with [staticmethod, classmethod]:
>
>      def foo(x):
>          pass
>
>      def bar(x):
>          pass
>
> IIUC, the PyObjC application needs whole swathes of functions with
> the same decoration, but this syntax isn't much worse for one
> function than for many.

No, that's a misunderstanding.. it was by coincidence alone that the 
last example I gave had two callbacks with an identical type signature. 
  Using a "with" block for decorators is as nonsensical as this:

with args(x):

     def foo:
         pass

     def bar:
         pass

-bob




More information about the Python-Dev mailing list