ANN: Experimental Number Types (Integer, Rational, Floats)

Delaney, Timothy tdelaney at avaya.com
Wed Apr 25 20:55:26 EDT 2001


> > 38/3   - not ambiguous, but falls into the problem of 
> integer truncation.
> > Nevertheless, I would prefer this notation, and deprecate 
> integer division
> > notation in favour of 'div' (since this would be a major 
> incompatible
> > language change anyway, might as well make a new keyword at 
> the same time
> > ;).
> 
> If rationals make it into the core some day, 38/3 might come out
> as rational, so there would not be any integer truncation. 
> The truncation
> would happen when converting the rational to an integer.

Err ... yes, this is precisely what I meant. Integer truncation using '/'
would be deprecated and '/' would (with the correct __future__ import) be
used for the creation of rationals. In the same __future__ import 'div' and
'mod' would become keywords. Later these would become mandatory.

I think 'div' and 'mod' are in keeping with python's style (c.f. 'or',
'and', etc) and are in common enough usage in other languages to not cause
problems for anyone.

Tim Delaney




More information about the Python-list mailing list