[Python-ideas] A number is a number

Guido van Rossum guido at python.org
Sat Jan 26 05:30:21 CET 2008


On Jan 25, 2008 8:27 PM, Neil Toronto <ntoronto at cs.byu.edu> wrote:
> Isn't it?
>
> Python 3.0 integers are just integers. Now ceil and floor return ints
> from float arguments. It seems like things are moving closer to just
> having a single "number" type. For most applications, because of duck
> typing, you'd never know or care whether you're punting a float, int, or
> complex number around, and you'd usually not care.
>
> Why not just go whole-hog and unify them all?

Because you don't want floats to be accidentally used as list indices.
And because range(0, 1, 0.1) would be poorly defined. And because you
can't order complex numbers.

For many purposes you never have to care about what kinds of numbers
you're manipulating. But there are still plenty of cases where it does
matter, and then the different types help.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-ideas mailing list