sum() requires number, not simply __add__

Terry Reedy tjreedy at
Fri Feb 24 22:58:11 CET 2012

On 2/24/2012 8:23 AM, Roy Smith wrote:
> In article<mailman.123.1330083762.3037.python-list at>,
>   Antoon Pardon<antoon.pardon at>  wrote:
>>> Python doesn't try to prevent people from shooting themselves in the foot.
>> Yes it does! A simple example is None as a keyword to prevent
>> assignments to it.
> Hmmm.  Just playing around with some bizarre things to do with None, and
> discovered this:
>>>> import sys as None
> doesn't give an error, but also doesn't assign the module to the symbol
> 'None'.  Weird.

In 3.2
 >>> import sys as None
SyntaxError: invalid syntax

Terry Jan Reedy

More information about the Python-list mailing list