proposed language change to int/int==float (was: PEP0238 lament)

Andy Salnikov salnikov at inp.nsk.su
Wed Jul 25 02:14:52 EDT 2001


"Guido van Rossum" <guido at python.org> wrote in message
news:cpitghbq05.fsf at cj20424-a.reston1.va.home.com...
>
> Thanks.  I am baffled by the many claims that for mathematicians 1/2
> equals zero; I've never met such a mathematicians.
>
  To many of us, programmers, 1/2 is 0 with 1 as a reminder:) We are like
children, and any child will say _for sure_ that 1 cookie for two children
means one cookie for 1 child and 0 cookies for another:)

> The interesting thing is that the one thing that has to change in
> order to get a unified numeric model, whether we introduce rationals
> in the numeric tower or not, is integer division!  A numeric tower
> with rationals could look like this:
>
>   int < long < rational < float < complex
>
  Just a comment: What bothers me is that floats in computers are not the
same as R continuum im math. This makes me think that rationals are "better"
than floats. Indeed, any float number can be exactly represented by
rational, but not vice virsa.  So my tower would be like that:

int < long < float < rational < complex float < complex rational

but, in general, it does not fit good in the linear chain, because floats
are too imprecise and limited. The whole picture would be better without
floats:)

> But PEP 238 can stand on its own.  If it is rejected, PEP 228 has no
> chance; but PEP 238 can be accepted and PEP 228 rejected and the world
> would still be a better place.
>
  Would not it be better to have rationals first and than change meaning of
int/int->rational, than changing first to int/int->float and then to
int/int->rational?

Cheers,
Andy.





More information about the Python-list mailing list