[Python-ideas] Proposal for function expressions

Mike Meyer mwm-keyword-python.b4bdba at mired.org
Wed Jul 15 03:13:45 CEST 2009


On Tue, 14 Jul 2009 14:38:34 -1000
Carl Johnson <cmjohnson.mailinglist at gmail.com> wrote:

> Steven D'Aprano wrote:
> 
> > The key=& seems like a mysterious Perlism -- what's the & operator doing
> > in there? (Admittedly, it *might* be nice to be able to write things
> > like reduce(&, alist) instead of reduce(operator.and_, alist). But
> > that's another story.) "do(item):" confuses me, because it looks like
> > the start of a do loop, but it isn't.
> 
> The thing about this debate that confuses me is why was the @
> decorator ever approved in the first place? It's line-noise, and
> worse, it's line-noise with a meaning completely different from any
> other language, ever.

You just stumbled on it. What other language, ever, had something like
decorators? It's a magic syntax that performs magic on the following
function definition. An unusual symbol in an unusual location is a clue
that something unusual is going on.

For a more thorough discussion of the reason for the adopted syntax, read
the PEP: http://www.python.org/dev/peps/pep-0318/.

    <mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



More information about the Python-ideas mailing list