Underscores in Python numbers

Dave Hansen iddw at hotmail.com
Tue Nov 8 15:18:27 CET 2005

On 7 Nov 2005 18:02:09 -0800 in comp.lang.python, "Gustav Hållberg"
<gustav at gmail.com> wrote:

>I tried finding a discussion around adding the possibility to have
>optional underscores inside numbers in Python. This is a popular option
>available in several "competing" scripting langauges, that I would love
>to see in Python.
>  1_234_567
>  0xdead_beef
>  3.141_592
>Would appreciate if someone could find a pointer to a previous
>discussion on this topic, or add it to a Python-feature-wishlist.

I've never needed them in Python, but I've very often wished for them
in C.  Along with 0b(0|1)* for binary numbers, where they'd be even
more useful.

Of course, I write _far_ more code in C than Python.  But I've seen
enough bugs of the sort where someone wrote 1200000 when they meant
12000000, that I see great value in being able to specify 12_000_000.


Change is inevitable, progress is not.

More information about the Python-list mailing list