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/047419.html below:

[Python-Dev] Decorators: vertical bar syntax

[Python-Dev] Decorators: vertical bar syntaxGuido van Rossum guido at python.org
Mon Aug 9 17:04:47 CEST 2004
[Guido]
> > 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.

[Bill Janssen]
> 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?

It's probably untenable as a formal principle. :-)

Nevertheless I don't like to put decorators in the method body.  I
think it has something to do with the fact that normally one thinks of
the body contents as relevalt to "call-time" while decorators happen
at "definition-time".

And before you bring up docstrings as a counterexample, yes, they
should ideally have been designed to precede the method, too.

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