[Python-ideas] Allow attribute references for decimalinteger

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Oct 31 23:59:12 CET 2013


Philipp A. wrote:
> 2013/10/31 Greg Ewing <greg.ewing at canterbury.ac.nz 
> <mailto:greg.ewing at canterbury.ac.nz>>
> 
>     In hindsight, things might have been better if the decimal point
>     were required to have at least one digit after it, 
> 
> i disagree. i like writing “1.” for “float(1)” and “.1” for “1/10”. 
> what’s the point of redundant zeros?

I meant that it would be better for the lexer, as it
would remove the ambiguity.

Personally I prefer to write '1.0' rather than '1.' in the
interests of readability, so it wouldn't bother me,
but I understand that others may feel differently.

Having said that, nowadays I'm not sure that there is
much reason to ever write '1.' rather than just '1',
since ints get promoted to floats in most contexts where
it's necessary. This is especially true now that the
division operator works sanely.

-- 
Greg


More information about the Python-ideas mailing list