|
|
|
|
|
by ahupp
908 days ago
|
|
If you're interested in this kind of thing, I wrote a python package called "unit-syntax"(https://github.com/ahupp/unit-syntax) that adds physical unit syntax to python: >>> speed = 5 meters/second
>>> (2 seconds) * speed
10 meter
I'd been using Jupyter notebooks as a calculator for engineering problems and was wishing for the clarity and type safety of real units, but with the succinctness of regular python.It works in both Jupyter notebooks (with an input transform) and stock python (with an import hook). The actual unit checks and conversions are handled by the excellent `pint` package. |
|