Bug in Python set

Terry Reedy tjreedy at udel.edu
Sun May 2 15:23:05 EDT 2010


On 5/2/2010 8:11 AM, dmitrey wrote:
> Python 2.6.5 r265:79063
>>>> set().update(set()) is None
> True
> while I expect result of update to be set.
> Also, result of
> set().add(None)
> is None while I expect it to be set with element None (or, maybe, it
> should be empty set?)

'Expect' has two different meanings in this context.
1. The empirical behavior surprised me (because I did not bother to read 
the manual, which clearly says what the returns are).
2. The documented behavior, which I read, surprises me, because I would 
have designed things differently, perhaps because I have used other 
languages designed differently.

I am not sure which you meant.






More information about the Python-list mailing list