[issue1762] Inheriting from ABC slows Decimal down.

2008-02-09 Thread Jeffrey Yasskin
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

[issue1762] Inheriting from ABC slows Decimal down.

2008-02-09 Thread Raymond Hettinger
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

[issue1762] Inheriting from ABC slows Decimal down.

2008-01-08 Thread Jeffrey Yasskin
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 __ ___

[issue1762] Inheriting from ABC slows Decimal down.

2008-01-08 Thread Christian Heimes
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

[issue1762] Inheriting from ABC slows Decimal down.

2008-01-08 Thread Christian Heimes
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

[issue1762] Inheriting from ABC slows Decimal down.

2008-01-08 Thread Christian Heimes
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