Poll - Vote here for "list-after-def" (was Decorator syntax)

AdSR artur_spruce at yahoo.com
Fri Aug 6 04:39:43 EDT 2004


Istvan Albert <ialbert at mailblocks.com> wrote in message news:<6LWdnZCpvI7Ico_cRVn-hw at giganews.com>...
> Paul McGuire wrote:
> 
>  > Please reconsider the "def f() [classmethod]:" construct.  Instead of
>  > invoking a special punctuation character, it uses context and placement,
>  > with familiar old []'s, to infuse the declaration of a function with special
>  > characteristics.  If this causes def lines to run longer than one line,
>  > perhaps the same rule that allows an unmatched "(" to carry over multiple
>  > lines without requiring "\" continuation markers could be used for unmatched
>  > "["s, as in:
>  >
>  > def f() [ staticmethod,
>  >     synchronized,
>  >     alphabetized,
>  >     supersized,
>  >     returns('d') ]:
> 
> Well said!
> <snip>
> I have the feeling that this always was and still is
> the favorite.

By the way, does anybody remember the first proposed syntax?

def f() as staticmethod, synchronized, alphabetized, \
           supersized, returns('d'):
    pass

Nowadays I'm more in favor of the list syntax, since in the future it
could be dynamized by allowing list comprehension. Not that you can't
achieve the same goal with static decorator list, using a decorator
that iterates over that dynamic list of decorators that you want.

Waking-up-the-dead-ly yours,

AdSR



More information about the Python-list mailing list