Underscores in Python numbers

Stefan Rank stefan.rank at ofai.at
Sat Nov 19 04:01:34 EST 2005


on 19.11.2005 06:56 Steven D'Aprano said the following:
[snip]
> 
> Perhaps Python should concatenate numeric literals at compile time:
> 
> 123 456 is the same as 123456.
> 
> Off the top of my head, I don't think this should break any older code,
> because 123 456 is not currently legal in Python.

+1

but only allow (a single ?) space(s), otherwise readability issues ensue.

The other idea of teaching int() about separator characters has 
internationalis/zation issues:
In many European countries, one would naturally try::

   int('500.000,23')

instead of::

   int('500,000.23')

--
stefan




More information about the Python-list mailing list