diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-08-25 17:10:17 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-08-25 17:10:17 (GMT) |
commit | 4924db176bdd0b4f93bf67c16487f468a1644c1c (patch) | |
tree | 63d4c7db1118b51e1d67fd72041115c9c671fcb3 /Lib | |
parent | c8f80345126808cd25c77f008b839449a922771f (diff) | |
download | cpython-4924db176bdd0b4f93bf67c16487f468a1644c1c.zip cpython-4924db176bdd0b4f93bf67c16487f468a1644c1c.tar.gz cpython-4924db176bdd0b4f93bf67c16487f468a1644c1c.tar.bz2 |
Record a clue about why __or__ is not union, etc.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sets.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/sets.py b/Lib/sets.py index d422591..ff0ace0 100644 --- a/Lib/sets.py +++ b/Lib/sets.py @@ -141,6 +141,11 @@ class BaseSet(object): # Standard set operations: union, intersection, both differences. # Each has an operator version (e.g. __or__, invoked with |) and a # method version (e.g. union). + # Subtle: Each pair requires distinct code so that the outcome is + # correct when the type of other isn't suitable. For example, if + # we did "union = __or__" instead, then Set().union(3) would return + # NotImplemented instead of raising TypeError (albeit that *why* it + # raises TypeError as-is is also a bit subtle). def __or__(self, other): """Return the union of two sets as a new set. |