[Python-Dev] PEP 318 - function/method/class decoration

Michael Hudson mwh at python.net
Mon Mar 8 07:44:49 EST 2004


Bob Ippolito <bob at redivi.com> writes:

> On Mar 6, 2004, at 12:42 PM, Bernhard Herzog wrote:
>
>> Bob Ippolito <bob at redivi.com> writes:
>>
>>> On Mar 6, 2004, at 12:17 PM, Bernhard Herzog wrote:
>>>
>>>> Bob Ippolito <bob at redivi.com> writes:
>>>>
>>>>> This proposed new syntax is:
>>>>>
>>>>> 	funcdef: 'def' NAME parameters ['[' exprlist ']' ] ':' suite
>>>>>
>>>>> 	classdef: 'class' NAME ['(' testlist ')'] ['[' exprlist ']'] ':'
>>>>> suite
>>>>
>>>> Why are the decorators an exprlist while the base classes are a
>>>> testlist?
>>>
>>> The testlist is the list of base classes..  In both cases, the
>>> decorators are an '[' exprlist ']'
>>
>> That much was obvious enough :).  What I meant was: Why are the
>> decorators an exprlist and not a testlist?  The base classes are a test
>> list and the elements of a list-literal that (listmaker in Grammar) are
>> effectively a testlist too, so it's not obvious why the decorators
>> should not also be a testlist.
>
> Oh, sorry.. haven't had my coffee yet.
>
> In that case, I'm not sure.  This is mwh's implementation, I'm sure
> there was a reason.

I wouldn't be :-)

Cheers,
mwh

-- 
  In the 1950s and 60s there was a regular brain drain of young
  Australians from the cities to London, but it was because of 
  money, culture and opportunity, not spiders.
           -- Al Grant, ucam.chat, from Owen Dunn's review of the year



More information about the Python-Dev mailing list