[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ideas
Subject:    Re: [Python-ideas] The way decorators are parsng
From:       Guido van Rossum <guido () python ! org>
Date:       2011-10-20 3:48:45
Message-ID: CAP7+vJLpd85ZdARM5ThOvvuHSpCkP8ZgHYHP0b_WJUw2St5ebw () mail ! gmail ! com
[Download RAW message or body]

2011/10/19 Nick Coghlan <ncoghlan@gmail.com>:
> 2011/10/20 Guido van Rossum <guido@python.org>:
>> If this gets changed we won't be able to give a different meaning to e.g.
>>
>> @(...)
>> @[...]
>> @{...}
>>
>> since those will all have to be accepted as valid forms of the syntax
>>
>> @<expr>
>
> True, although the restriction could just be weakened to "must start
> with an identifier" rather than eliminated entirely. Since tuples,
> lists, dictionaries and sets aren't callable, that wouldn't be a
> noticeable restriction in practice.

But surely someone would manage to come up with a use case for an
expression *starting* with one of those, e.g.

@[f, g, h][i]

or

@{a: b, c: d}[x]

I don't think it's reasonable to constrain it less than it currently
is but more than a general expression. Though I wouldn't allow commas
-- there's no way that

@f, g
def pooh(): ...

can make sense. Oh way, it could be a shorthand for

@f
@g
def pooh(): ...

:-)

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic