[Python-ideas] Improve readability of long numeric literals

Joshua Landau joshua at landau.ws
Tue Feb 9 22:32:51 EST 2016


On 10 February 2016 at 02:46, Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Feb 10, 2016 at 1:18 PM, Joshua Landau <joshua at landau.ws> wrote:
>> On 10 February 2016 at 00:45, MRAB <python at mrabarnett.plus.com> wrote:
>>> The Ada programming language allows underscores in numerals, but requires
>>> there to be a digit on both sides of the underscore.
>>
>> +1 to this.
>
> I'm not sure how that would get encoded into the grammar, but
> certainly that's the advice I would recommend for style guides.

You do the BNF equivalent of turning \d\d* to \d(\d|_\d)*. It should
be really simple.


More information about the Python-ideas mailing list