Ubuntu 12.04 python 3.3
I was working through an exercise about sets. I needed to find the
duplicates in a list and put them in a set. I figured the solution had
to do with sets not supporting duplicates. I finally figured it out but
along the way I was experimenting in idle and got some results I don't
understand.
>>> s = {1,2,3}
>>> s
{1, 2, 3}
>>> s.add(1) == s # <1>
False
>>> s.add(1) == s.add(2) # <2>
True
>>>
Neither <1> or <2> changes s, so why is <1> False and <2> True ?
Thanks, Jim
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor