[Python-Dev] Decorators: vertical bar syntax

Heiko Wundram heikowu at ceosg.de
Sat Aug 7 11:27:04 CEST 2004


Am Samstag, 7. August 2004 06:35 schrieb Edward Loper:
> I'm including both of the following variants:
>      |classmethod
>      |accepts(int, int)
>      |returns(float)
>
>      def foo(arg1, arg2):
>          ...
>
>      def foo(arg1, arg2):
>          |classmethod
>          |accepts(int, int)
>          |returns(float)
>
>          ...
>
> (I prefer the second, but would be happy with either.)

-0.5 for the first, because | hard to read (I just noticed that in my eMail 
client), and -1 for the second, because decorating a function (some of you 
suggested even _after_ the docstring) in the actual function takes away all 
there is to decorators: making it immediately clear that a function is being 
decorated. If we would have to specify decorators after the actual def and 
the doc-string, there'd be no need for decorators, as that's what we can do 
at the moment too.

Heiko.


More information about the Python-Dev mailing list