Why Python don't accept 03 as a number?

Serhiy Storchaka storchaka at gmail.com
Sat Dec 8 04:20:11 EST 2018


08.12.18 08:53, Henrik Bengtsson пише:
> A comment from the sideline: one could imagine extending the Python syntax
> with a (optional) 0d prefix that allows for explicit specification of
> decimal values. They would "complete" the family:
> 
> * 0b: binary number
> * 0o: octal number
> * 0d: decimal number
> * 0x: hexadecimal number
> 
> I understand that changing the syntax/parser is a major move. I wouldn't be
> surprised if others brought up 0d before.

It is more likely that 'd' will be used for Decimal literals.

1d-2 == Decimal('0.01')




More information about the Python-list mailing list