[Python-ideas] real numbers with SI scale factors

Sven R. Kunze srkunze at mail.de
Tue Aug 30 06:47:38 EDT 2016


On 30.08.2016 04:34, David Mertz wrote:
> On Mon, Aug 29, 2016 at 1:55 PM, Sven R. Kunze <srkunze at mail.de 
> <mailto:srkunze at mail.de>> wrote:
>
>     There was no reasonable real-world code examples taken from
>     important projects, that would be significantly improved by
>     underscores in numbers.
>
>
> I recall dozens of real world examples that came up during the 
> discussion, and have written very numerous such examples in code of my 
> own.  This is something that directly affects readability in code I 
> write almost every day, and is a clear and obvious win.
> I taught examples *today* where I would have badly liked to have 
> underscore separators, and it was obvious to me and students that 
> awkwardness.  Writing, e.g. `range(int(1e7))` feel contrives (but 
> usually the way I do it).  Writing `range(10000000)` is nearly 
> impossible to parse visually.  In contrast, writing 
> `range(10_000_000)` will be immediately clear and obvious.
>
> None of those things can be said of SI units as Python literals.

Hu? None of those things? I do think you exaggerate quite a lot here.

If your real-world example works for underscores, it works for SI units 
and scales as well.


I for one don't have usage of either, so having such a distance to the 
subject at hand, I don't see this as a compelling argument against/for 
his proposal.


Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160830/5f7786b7/attachment.html>


More information about the Python-ideas mailing list