Jeffrey Yasskin added the comment:
I measured various implementations of __instancecheck__ using
`./python.exe -m timeit -s 'from rational import Rational; r =
Rational(3, 2)' '...'` on my 2.33 GHz MacBook, with ... replaced by
either isinstance(r, Rational) or isinstance(3, Rational) to measure
Raymond Hettinger added the comment:
Whoa! I thought we had arrived at a decision to leave decimal alone.
Please do not infect this module with numbers.py.
--
nosy: +rhettinger
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1762
Jeffrey Yasskin added the comment:
I've only verified the behavior on 2.6, but I suspect it's true for both.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1762
__
___
Christian Heimes added the comment:
__instancecheck__ contains unnecessary code. If we restrict ABCs to new
style classes we could make the function faster:
Old:
def __instancecheck__(cls, instance):
Override for isinstance(instance, cls).
return
Christian Heimes added the comment:
The patch implements the rich cmp slots for , =, and = required for
numbers.Real.
Added file: http://bugs.python.org/file9107/trunk_decimal_richcmp.patch
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1762
Christian Heimes added the comment:
without abc:
$ time ./python Lib/test/regrtest.py test_decimal
real0m10.113s
user0m9.685s
sys 0m0.196s
with numbers.Real subclass:
$ time ./python Lib/test/regrtest.py test_decimal
real0m16.232s
user0m15.241s
sys 0m0.384s
Proposed