[Python-checkins] python/dist/src/Lib sets.py,1.20,1.21
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Sun, 25 Aug 2002 10:10:19 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv4845/python/lib
Modified Files:
sets.py
Log Message:
Record a clue about why __or__ is not union, etc.
Index: sets.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** sets.py 24 Aug 2002 07:33:06 -0000 1.20
--- sets.py 25 Aug 2002 17:10:17 -0000 1.21
***************
*** 142,145 ****
--- 142,150 ----
# 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):