A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-June/090194.html below:

[Python-Dev] Adding syntax for units of measure

[Python-Dev] Adding syntax for units of measure [Python-Dev] Adding syntax for units of measureskip at pobox.com skip at pobox.com
Wed Jun 24 06:07:02 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.
    ...
    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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4