diff options
author | Guido van Rossum <guido@python.org> | 2001-01-18 22:07:06 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-01-18 22:07:06 (GMT) |
commit | a3af41d5646c629d19b844e094afa58fdcd129f9 (patch) | |
tree | 7239ac16a7d6dca13df1dbc75bb9b92dd4a74a6b /Lib | |
parent | 4e8db2ed9d767ac0d73f9552f7847b3b32af580c (diff) | |
download | cpython-a3af41d5646c629d19b844e094afa58fdcd129f9.zip cpython-a3af41d5646c629d19b844e094afa58fdcd129f9.tar.gz cpython-a3af41d5646c629d19b844e094afa58fdcd129f9.tar.bz2 |
Changes to recursive-object comparisons, having to do with a test case
I found where rich comparison of unequal recursive objects gave
unintuituve results. In a discussion with Tim, where we discovered
that our intuition on when a<=b should be true was failing, we decided
to outlaw ordering comparisons on recursive objects. (Once we have
fixed our intuition and designed a matching algorithm that's practical
and reasonable to implement, we can allow such orderings again.)
- Refactored the recursive-object comparison framework; more is now
done in the support routines so less needs to be done in the calling
routines (even at the expense of slowing it down a bit -- this
should normally never be invoked, it's mostly just there to avoid
blowing up the interpreter).
- Changed the framework so that the comparison operator used is also
stored. (The dictionary now stores triples (v, w, op) instead of
pairs (v, w).)
- Changed the nesting limit to a more reasonable small 20; this only
slows down comparisons of very deeply nested objects (unlikely to
occur in practice), while speeding up comparisons of recursive
objects (previously, this would first waste time and space on 500
nested comparisons before it would start detecting recursion).
- Changed rich comparisons for recursive objects to raise a ValueError
exception when recursion is detected for ordering oprators (<, <=,
>, >=).
Unrelated change:
- Moved PyObject_Unicode() to just under PyObject_Str(), where it
belongs. MAL's patch must've inserted in a random spot between two
functions in the file -- between two helpers for rich comparison...
Diffstat (limited to 'Lib')
0 files changed, 0 insertions, 0 deletions