3 ms·
There are usually libraries for doing this. For Python, there are several, for instance “Pint”.
by teddyh 5y ago
There are usually libraries for doing this. For Python, there are several, for instance “Pint”.
- BlueTemplar 5y agoI was excited when I found Pint, but then was disappointed : too much extra overhead for the project I was then working on. (I settled on units in variable names instead, was essential when some inputs were literally in different units of the same physical dimension.) EDIT : more on this, and on astropy (which I was not aware of and/or didn't exist back then) : https://github.com/astropy/astropy/issues/7438 https://github.com/astropy/astropy/issues/7438