[Python-ideas] 1_000_000

dag.odenhall at gmail.com dag.odenhall at gmail.com
Fri May 6 23:06:18 CEST 2011


On 6 May 2011 19:51, Matt Chaput <matt at whoosh.ca> wrote:
> Not sure if this has been proposed before: A syntax change to allow
> underscores as thousands separators in literal numbers to improve
> readability, e.g.:
>
>  for i in range(1, 1_000_000):
>    pass
>
> I believe D allows this and while it's a small thing it really is much more
> readable.

Ruby too.

You could also use e-notation[1]: 1e6, in your example. In many
situations it's even more readable because you don't need to "count
the zeros". This is already supported in Python.

[1] http://en.wikipedia.org/wiki/Scientific_notation#E_notation



More information about the Python-ideas mailing list