[Python-ideas] SI scale factors alone, without units or dimensional analysis

Paul Moore p.f.moore at gmail.com
Sun Aug 28 06:37:00 EDT 2016


On 27 August 2016 at 23:39, Arek Bulski <arek.bulski at gmail.com> wrote:
> They can be used simply out of convenience, like 4K is a shorthand for 4000.
> And 9G is definitely easier to write and *therefore less prone to error*
> than a full literal.

I dispute "less prone to error". Like it or not, there are a lot of
people who would interpret "4K" as 4096. You can argue whether they
are right or wrong all you like, but the fact remains that 4K is open
to misinterpretation in a way that 4096 or 4000 is not. The (minimal)
convenience of being able to write 4K rather than 4000 doesn't, in my
mind, outweigh the risk.

And if you're concerned about larger numbers, such as 16000000000, and
the need to count zeroes, I'd argue that you should name such a
constant - and Python 3.6 will allow you to write it as 16_000_000_000
in any case, making things completely clear.

Paul


More information about the Python-ideas mailing list