sum() requires number, not simply __add__

Chris Angelico rosuav at gmail.com
Thu Feb 23 18:39:26 EST 2012


On Fri, Feb 24, 2012 at 10:33 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Yes, deleting _sentinel will cause the custom sum to fail, and yes, you
> have missed something.
>
> If the caller wants to mess with your library and break it, they have
> many, many ways to do so apart from deleting your private variables.

I was looking at the module breaking itself, though, not even waiting
for the caller to do it.

ChrisA



More information about the Python-list mailing list