[Python-Dev] PEP 515: Underscores in Numeric Literals (original) (raw)

Chris Angelico rosuav at gmail.com
Thu Feb 11 06:12:40 EST 2016


On Thu, Feb 11, 2016 at 7:22 PM, Georg Brandl <g.brandl at gmx.net> wrote:

* Allowing underscores in string arguments to the Decimal constructor. It could be argued that these are akin to literals, since there is no Decimal literal available (yet).

* Allowing underscores in string arguments to int() with base argument 0, float() and complex().

I'm -0.5 on both of these, with the caveat that if either gets done, both should be. Decimal() shouldn't be different from int() just because there's currently no way to express a Decimal literal; if Python 3.7 introduces such a literal, there'd be this weird rule difference that has to be maintained for backward compatibility, and has no justification left.

(As a side point, I would be fully in favour of Decimal literals. I'd also be in favour of something like "from future import fraction_literals" so 1/2 would evaluate to Fraction(1,2) rather than 0.5. Hence I'm inclined not to support underscores in Decimal().)

ChrisA



More information about the Python-Dev mailing list