Chris Angelico wrote:

Truncating vs true is not the same as int vs float. If you mean to
explicitly request float division, you call float() on one or both
arguments. You're being explicit about something different.

If you know you're dealing with either ints or floats,
which is true in the vast majority of cases, then you
know that / will always perform float division.

As for why int/int should yield float and not some
other type, float is alreay special -- it's built-in
and has syntactic support in the form of literals.
It's the most obvious choice.

If a version of Python were ever to exist in which
floating-point literals produced Decimals instead of
floats, then int/int would produce a Decimal.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to