[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

Mark Dickinson report at bugs.python.org
Sat Feb 28 15:56:01 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

The behaviour doesn't contradict the documentation, as far as I can 
tell, 
so I agree with Terry that this is not a bug.

If we want the result from the built-in int function to have type int 
whenever possible (that is, whenever the result is in the closed 
interval 
[-sys.maxint-1, sys.maxint], it doesn't seem right that the burden for 
ensuring this should lie with individual __int__ methods:  instead, the 
general machinery for implementing the built-in int function should 
check 
any result of type long to see if it fits in an int, and convert if so.

Is this desirable?

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5377>
_______________________________________


More information about the Python-bugs-list mailing list