[issue1968] Unused number magic methods leaked into Py2.6

Raymond Hettinger report at bugs.python.org
Tue Jan 29 23:55:50 CET 2008


New submission from Raymond Hettinger:

The Py2.6 code has __round__, __ceil__, and __floor__ methods still in
several objects (int, longs, float, Rational) but they are not invoked
by anything.   For example, round(Rational(22,7)) does not use the
Rational.__round__ code and round(22) does not use the code for
int.__round__; the code is just ignored.  Since the code is not used, it
probably shouldn't be in Py2.6.

I think these backports happened before Guido decided, "I think the
pre-3.0 rule should be: round(), math.floor(), math.ceil()
*always* return a float."  Probably, rev 59731 may have intended to
revert these changes but just missed them.  IIRC, the decision was that
only __trunc__ would be backported and the other three magic methods
would wait for Py3.0 where their invocation functions would get their
new signature and start calling the magic methods.

----------
assignee: jyasskin
messages: 61835
nosy: jyasskin, rhettinger
severity: normal
status: open
title: Unused number magic methods leaked into Py2.6
versions: Python 2.6

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1968>
__________________________________


More information about the Python-bugs-list mailing list