diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-05-15 20:12:59 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-05-15 20:12:59 (GMT) |
commit | d7ed3bf5524f68860536e330e2a5b1cc50c10f77 (patch) | |
tree | 18735acd5afb38a5435cca47bf764fbe2b50b4cc /Lib/encodings/cp862.py | |
parent | fab96cc2ffd2834a0c2e6c10f5649740e87b6214 (diff) | |
download | cpython-d7ed3bf5524f68860536e330e2a5b1cc50c10f77.zip cpython-d7ed3bf5524f68860536e330e2a5b1cc50c10f77.tar.gz cpython-d7ed3bf5524f68860536e330e2a5b1cc50c10f77.tar.bz2 |
Speed tuple comparisons in two ways:
1. Omit the early-out EQ/NE "lengths different?" test. Was unable to find
any real code where it triggered, but it always costs. The same is not
true of list richcmps, where different-size lists appeared to get
compared about half the time.
2. Because tuples are immutable, there's no need to refetch the lengths of
both tuples from memory again on each loop trip.
BUG ALERT: The tuple (and list) richcmp algorithm is arguably wrong,
because it won't believe there's any difference unless Py_EQ returns false
for some corresponding elements:
>>> class C:
... def __lt__(x, y): return 1
... __eq__ = __lt__
...
>>> C() < C()
1
>>> (C(),) < (C(),)
0
>>>
That doesn't make sense -- provided you believe the defn. of C makes sense.
Diffstat (limited to 'Lib/encodings/cp862.py')
0 files changed, 0 insertions, 0 deletions