A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-August/047279.html below:

[Python-Dev] Decorators: vertical bar syntax

[Python-Dev] Decorators: vertical bar syntaxGuido van Rossum guido at python.org
Sat Aug 7 18:17:42 CEST 2004
> The new "vertical bar" syntax was proposed recently, and has gotten
> almost unanimously positive feedback.  In particular, of 17 responses
> to the syntax, only one has been negative (see table, below).

I want to mention one argument for '@' that doesn't apply to '|': it
will be familiar to Java programmers.

> 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.)

In the discussion on decorators months ago, solutions involving
special syntax inside the block were ruled out early on.  Basically,
you shouldn't have to peek inside the block to find out important
external properties of the function.  (Yes, I know that docstrings
violate this principle.  For the record, it would be better if they
were prefix too; and a prefix decorator syntax will let us fix this in
the future but introducing a "doc" decorator.)

Please add this to the Wiki for me.

--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4