3 ms·
The Python package astropy extends numpy arrays to include units.[0] It can convert between equivalent units (e.g., centimeters and kilometers), and will compl
by DiogenesKynikos 5y ago
The Python package astropy extends numpy arrays to include units.[0]
It can convert between equivalent units (e.g., centimeters and kilometers), and will complain if you try to add quantities that aren't commensurate (e.g., grams and seconds).
The nice thing about this is that you can write functions that expect unit-ful quantities, and all the conversions will be done automatically for you. And if someone passes an incorrect unit, the system will automatically spit out an error.
0. https://docs.astropy.org/en/stable/units/index.html https://docs.astropy.org/en/stable/units/index.html