Feedback on Sets, and Partitions
Andrew Koenig
ark at acm.org
Fri Apr 30 13:52:44 EDT 2004
> I could live with only immutable sets, but it is nice
> being able to use:
> myset.add(x)
>
> instead of:
> newmyset = myset | Set([x])
What about
myset |= Set([x])
Presumably that would work analogously to += for strings.
> Another unintutive feature is that there can be multiple sets with the
> same members. I.e., you can have sets A and B such that "A == B" is true
> and "A is B" is false.
Why is that any more unintuitive than the fact that there can be multiple
integers with the same value?
For example:
x = 12345
y = 12344+1
After these two statements, most Python implementations will evaluat "x is
y" as false, but of course 1==y is true.
More information about the Python-list
mailing list