[Python-Dev] Adding syntax for units of measure
Tobias C. Rittweiler
tcr at freebits.de
Tue Jun 23 08:47:36 CEST 2009
Has anyone added special syntax to allow writing numeric literals with
physical units? So you can write 12m + 34cm, and would get 12.34m.
My question is how would you modify the BNF the most sensible way to
allow for this? The above example is simple, but think of 42 km/h.
(For my purposes, modifying the BNF is perfectly reasonable, but if you
can depict a good, and convenient!, way that would not result in
modifying it, I'd like to hear it, too.)
Thanks in advance for your input,
More information about the Python-Dev