[Python-3000] Removing functions from the operator module

Michael Urman murman at gmail.com
Mon Jul 3 16:52:40 CEST 2006


On 7/3/06, Guido van Rossum <guido at python.org> wrote:
> On 7/3/06, Collin Winter <collinw at gmail.com> wrote:
> > Stupid question: why? What's the better spelling of operator.add?
>
> +

I reject your slippery slope argument that we'd have to remove
operator.add. Not that we'd be able to tell, but + is not callable. Or
would that change as well? (Actually the more I briefly consider
making in place operators the callables that perform the represented
operation, the more attractive it seems, if it doesn't blow the parser
out of the water.)

SyntaxError: invalid syntax
>>> reduce(+, [1,2,3,4])
  File "<stdin>", line 1
    reduce(+, [1,2,3,4])
            ^
SyntaxError: invalid syntax

Michael
-- 
Michael Urman  http://www.tortall.net/mu/blog


More information about the Python-3000 mailing list