On Mon, Jun 4, 2018 at 1:59 PM, Pål Grønås Drange <[email protected]>
wrote:
> For the general user-defined literals, here are some example use cases:
>
I kind of like the idea of user-defined literals, but:
> Yes, we could write all these as easily as function calls,
>
> deg(90)
> celsius(20)
> center('my string') # or 'my string'.center(80)
>
> But somehow it seems nicer to write 42_km than 12 * pint.UnitRegistry().km
>
how about?
from pint import km
42*km
still not as nice as 42_km, though only by a bit....
So maybe you could propose adding:
seconds
minutes
hours
days
to the datetime module, and then we could write:
60*seconds == 1*minutes
Without any changes to the language at all.
-CHB
>
>
> - Pål
>
> _______________________________________________
> Python-ideas mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[email protected]
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/