A RetroSearch Logo

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

Search Query:

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

[Python-Dev] Decorators: vertical bar syntax

[Python-Dev] Decorators: vertical bar syntaxJames Y Knight foom at fuhm.net
Mon Aug 9 18:38:35 CEST 2004
On Aug 8, 2004, at 9:31 PM, Bill Janssen wrote:

> Guido, could you expand on this principle a bit?  Just stated as it
> is, it sounds as pointless (to my untutored mind, at least :-), as the
> arguments about "@ is ugly, so it shouldn't be used".  After all,
> isn't "what the function does" an important external property of the
> function, and don't you have to peek inside the block to determine
> that?  For instance, how do you know whether a function is a generator
> unless you look for yield statements inside it?

A function being a generator only* affects the return value, so not 
knowing what functions are generator functions are really just a 
special case of not knowing the return value of any function. That can 
be solved with documentation, or a decorator.
e.g.
@returns(types.GeneratorType)

James

*: well not really, but to the external caller it's equivalent.

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