On Tue, 30 Aug 2016 at 12:48 Sven R. Kunze <srku...@mail.de> wrote: > On 30.08.2016 04:34, David Mertz wrote: > > On Mon, Aug 29, 2016 at 1:55 PM, Sven R. Kunze <srku...@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. > > There is obvious way now:
G = Ghz = 1000 frequency = 1 * Ghz You can even have a non naive version Ghz that supports conversions and unit checking when doing arithmetic with it.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/