by chrismorgan · 2y ago · 0 comments
>>> speed = 5*meters/second
>>> (2 * seconds) * speed
10 meter
Given the ecosystem problems and other problems extending the syntax gets you, I don’t get why you’d do this at all, when all it gets you is the ability to write ' ' instead of '*'.> I don’t understand why you’d go to the enormous trouble
But more importantly, it was just really fun to get it working.
Units are inherently exactly multiplication.
5 meters is:
5 (unitless) * (1) meter
You could also use python type hints for this stuff.
Here are some links about units in python:
https://socialcompare.com/en/comparison/python-units-quantit...