PEP318 alternate syntax idea

Skip Montanaro skip at pobox.com
Tue Mar 23 22:03:58 CET 2004


    Jim> With decorators, the function definition itself is normal (and
    Jim> therefore should not be indented); it is the decorators that run at
    Jim> an unexpected time.

    Jim> using:
    Jim>     decorator1
    Jim>     decorator2
    Jim>     decorator3
    Jim> def a (args):
    Jim>     pass

Note that the undent at the end of the using: block also implies that "we're
done" with the block.  If I wrote

    using:
        decorator1
        decorator2
        decorator3
    def a (args):
        pass
    def b (args):
        pass

would a and b both be decorated or just a?  What about if I wrote

    using:
        decorator1
        decorator2
        decorator3
    x = really_complex_default()
    def a (arg1, arg2=x):
        pass

Would a be decorated or not?

Skip




More information about the Python-list mailing list