remaining decorator syntax options
John Carter
jnc at ecs.soton.ac.uk
Wed Aug 11 08:56:06 EDT 2004
>*** List notation
>
>Assuming a pre-def, non-indented decorator, here are the remaining
>list notations:
>
>(1)
><indicator> dec1
><indicator> dec2
><indicator> dec3
>
>(2)
><indicator> [dec1, dec2, dec3]
>
>(3)
><indicator> dec1, dec2, dec3
>
>I believe that version 3 was vetoed because it makes it too hard to
>break lists of decorators across lines. GvR's preference is
>definitely for 1, but that may be influenced by his decision for the
>indicator. I have a feeling that how long the indicator is directly
>affects which of (1) or (2) is preferred. Compare:
>
>@dec1
>@dec2
>@dec3
>
>vs.
>
>@[dec1, dec2, dec3]
>
>and
>
>using dec1
>using dec2
>using dec3
>
>vs.
>
>using [dec1, dec2, dec3]
>
If one must have a new keyword, i.e. usin, then how about following
the syntax of the rest of python's control structures.
using:
dec1
dec2
dec3
def func():
pass
An alternative syntax I thought of, which dosnt use a new key word was
def func() with [dec1, dec2, dec3]:
pass
'with' has the same sort of association feeling as 'using'
This is probably ruled out of court as being after the fnction name.
It does have the merit of generating a syntax error in 2.3
John Carter
More information about the Python-list
mailing list