>> Has anyone added special syntax to allow writing numeric literals with >> physical units? So you can write 12m + 34cm, and would get 12.34m. ... Georg> normally you wouldn't add units to the language itself. ... Georg> For the interactive shell, using a wrapper that allows simplified Georg> input is also a possibility, like IPython's "-profile physics" Georg> mode, or something like http://bitbucket.org/birkenfeld/phsh/ Georg> which allows you to write
>>>> `1 m` + `12 cm` Georg> 1.12 m Also, check out the magnitude module (in PyPI). I use it to specify the units of the computation but allow users to input values using units which are meaningful to them. So, for example, if a value has units of time they could enter 1m or 60s and get the same internal value. Skip _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com