[Python-ideas] Improve readability of long numeric literals

Ethan Furman ethan at stoneleaf.us
Tue Feb 9 18:02:38 EST 2016


On 02/09/2016 01:40 PM, Manuel Cerón wrote:

> Sometimes it's hard to read long numbers. For example:
>
>  >>> opts.write_buffer_size = 67108864
>
> Some languages (Ruby, Perl, Swift) allow the use of underscores in
> numeric literals, which are ignored. They are typically used as
> thousands separators. The example above would look like this:
>
>  >>> opts.write_buffer_size = 67_108_864

As I recall, a number of years ago we had this discussion and Guido 
approved the idea.  The only email I could locate at the moment, though, 
shows his support of the idea, but not outright approval. [1]

I dare say if somebody submitted a patch it would fare well.  (As in: be 
accepted, not gone forever.)

--
~Ethan~



[1] https://mail.python.org/pipermail/python-ideas/2011-May/010157.html


More information about the Python-ideas mailing list