summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-22 17:23:33 (GMT)
committerGuido van Rossum <guido@python.org>2002-08-22 17:23:33 (GMT)
commitdc61cdf6c0f433cba6a51b05346acb5b538a7617 (patch)
treed48631dc6ac224d87f253394f0d37144089f39d6 /Mac
parent13090e1025470c79def3f626f55971e519e9fd17 (diff)
downloadcpython-dc61cdf6c0f433cba6a51b05346acb5b538a7617.zip
cpython-dc61cdf6c0f433cba6a51b05346acb5b538a7617.tar.gz
cpython-dc61cdf6c0f433cba6a51b05346acb5b538a7617.tar.bz2
Change the binary operators |, &, ^, - to return NotImplemented rather
than raising TypeError when the other argument is not a BaseSet. This made it necessary to separate the implementation of e.g. __or__ from the union method; the latter should not return NotImplemented but raise TypeError. This is accomplished by making union(self, other) return self|other, etc.; Python's binary operator machinery will raise TypeError. The idea behind this change is to allow other set implementations with an incompatible internal structure; these can provide union (etc.) with standard sets by implementing __ror__ etc. I wish I could do this for comparisons too, but the default comparison implementation allows comparing anything to anything else (returning false); we don't want that (at least the test suite makes sure e.g. Set()==42 raises TypeError). That's probably fine; otherwise other set implementations would be constrained to implementing a hash that's compatible with ours.
Diffstat (limited to 'Mac')
0 files changed, 0 insertions, 0 deletions