[issue4479] True division is not smart -> proposing smart True division

Hatem report at bugs.python.org
Mon Dec 1 12:43:04 CET 2008

Hatem <hnassrat at gmail.com> added the comment:

On Mon, Dec 1, 2008 at 7:15 AM, Mark Dickinson <report at bugs.python.org> wrote:
> Well, there are precedents:
>>>> type(2**3)
> <type 'int'>
>>>> type(2**-3)
> <type 'float'>
> My initial reaction to this was negative, but I'm struggling to think of
> situations where it would be bad.  I'm also struggling to think of
> situations where it would be useful.   Maybe Monday morning is just a
> bad time for thinking. :-)
> Might be worth a discussion on python-ideas, at least?

I don't know about the internal representations in python, but I
believe ints can be larger than ints. Nevertheless your example there
which would have drove me nuts if I found it :-). I like the true
division feature, but I find it too far deviant, if all of a sudden
code started producing floats instead of ints, on a given upgrade of
python someday soon.

I think the result should be int if it is an int, but float if and
only if it is really needed.

I think your right, this conversation should probably move to python
ideas, since this was by design and not a bug. (but I do not really
like this part of the "feature").

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list