[issue4090] Documenting set comparisons and operations
Mark Dickinson
report at bugs.python.org
Fri Oct 10 10:57:36 CEST 2008
Mark Dickinson <dickinsm at gmail.com> added the comment:
[Raymond]
> I don't think this is necessary.
I disagree. I think some sort of warning is necessary; it doesn't need
to be particularly prominent, but it should be there.
Almost *all* expectations are broken for sets in the absence of
transitivity of equality for the set elements. Consider the following
(Python 2.6) snippet involving a set s:
>>> s.remove(17)
>>> 17 in s
True
An element is removed from a set s, and yet it's still present after the
removal! Doesn't this deserve an explanation somewhere?
In case you haven't guessed, here's what s is:
>>> s
set([Fraction(17, 1), Decimal('17')])
Regardless of whether one wants to call this a bug or not, I think it's
sufficiently unintuitive and surprising that it should be documented.
Terry's suggestion and wordings for the reference and library warnings
look good to me.
----------
nosy: +marketdickinson
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4090>
_______________________________________
More information about the Python-bugs-list
mailing list