This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author creedy
Recipients
Date 2003-02-25.19:37:45
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Comparing Sets to non-Sets results in a TypeError. For
example:

>>> from sets import Set
>>> x = Set([1])
>>> x == 2
TypeError: Binary operation only permitted between sets

This seems to be inconsistent  with other Python
behavior. For example:

>>> (1,2,3) == 2
0
>>> "abcd" == 2
0

Assuming that the standard behavior is what is desired,
the implementation of __eq__ and other comparison
operators in sets.py should be changed to return
NotImplemented when the other object is not a Set.

Note: Looking at the code, I'm not sure whether the
implementation of __lt__, __le__, etc. should also be
changed to not return a Type Error.
History
Date User Action Args
2007-08-23 14:11:27adminlinkissue693121 messages
2007-08-23 14:11:27admincreate