Ken Kundert writes:

 > I'd like to continue the discussion because I believe there is some
 > chance that we could reach that bar even though Guido is clearly
 > skeptical.

OK.

 > input to the language. To be consistent with that, it seems like 2G
 > or 2GHz should be preferred over 2_G or 2_GHz.

Sure, *in the user interface*.  The Python interpreter REPL is a user
interface, but it's a "bare minimum" intended to expose the language
and no more.  Interfaces like Jupyter can provide the heuristic that
an identifier following a numeric literal is a "unit" (whatever we
decide that should be, a type as I suggest, semantically null as you
seem to prefer, or something else) without changing the language.
This separation of concerns also allows Python (the language) to
experiment with different implementations of "unit" while Jupyter
maintains its user interface without change.

If you want to change the *language* you need to provide answers to
the following.  I have no answers to them that I like, but maybe you
can do better.

How about 2.4Gaunitwithaveryveryveryveryveryverylongname?

Consider the chemical unit "mol".  How do you distinguish "1 mol" from
"1/1000 ol"?

Similarly, how do you distinguish "1 joule" from "1 imaginary oule"?

If you allow both naked prefixes and prefixed units, how do you
distinguish "1/10 a" from "10" when both are represented "1da"?

 > One last thing, we can accept 273K as input for 273,000, but when
 > we output it we must use k to avoid confusion with Kelvin (and
 > because that is the standard).

I think that's unacceptable.  If "273K" has the valid interpretation
"0 degrees Celcius" and we're going to accept units at all, we must
not ask users to type 273000mK or even 2730dK.  So if we ever accept
"1K" to mean 1000, we're kinda hosed for accepting units.  I think
units syntax is broken anyway per the examples above, and Guido
already pronounced on "naked scale prefixes":

 > On Fri, Aug 26, 2016 at 07:42:00AM -0700, Guido van Rossum wrote:

 > > Please curb your enthusiasm. This is not going to happen.

+1  Guido may have retracted this pronouncement in private mail, but
by that same token, he can reinstate it.  I've learned to trust his
first reactions; backing off this way is a symptom of openness to new
ideas, not inaccuracy of the first reaction.

Steve
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to