[Python-Dev] Re: PEP 318: Decorators last before colon
Guido van Rossum
guido at python.org
Wed Mar 31 13:41:29 EST 2004
> If you spell decorators this way:
>
> [decorator]
> def func():
> pass
>
> then what will happen when you type [decorator] at an interactive
> interpreter prompt?
>
> >>> [decorator]
>
> Will it type ... and wait for you to say more? Or will it evaluate the
> single-element list whose element is the value of the variable ``decorator''
> and print the result?
The latter. You can't add a decorator to a top-level function in
interactive mode unless you put it inside an if.
Check out the behavior of the patch I posted (926860).
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list