Underscores in Python numbers

bonono at gmail.com bonono at gmail.com
Fri Nov 18 19:26:08 EST 2005


Personally, I would rather see the int() and float() function be
smarter to take what is used for this, i.e. :

a = int("1,234,567")

Of course, also support the locale variant where the meaning of "," and
"." is swapped in most European countries.

Gustav Hållberg 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.
>
> Examples:
>   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.
> 
> - Gustav




More information about the Python-list mailing list