4 ms·
>>> [3, 4] * ureg.meter + [4, 3] * ureg.cm <Quantity([ 3.04 4.03], 'meter')> This numpy example was confusing to me because of the digit reuse; it looked to
by ealexhudson 5y ago
>>> [3, 4] * ureg.meter + [4, 3] * ureg.cm
<Quantity([ 3.04 4.03], 'meter')>
This numpy example was confusing to me because of the digit reuse; it looked to me like the second quantity should have been in metres. I think something like this would have been better:
>>> [3, 4] * ureg.meter + [5, 6] * ureg.cm
<Quantity([ 3.05 4.06], 'meter')>
- kzrdude 5y agoWhile we are making improvements to examples, I would want to read code that looks like this: >>> 3 * units.meter + 4 * units.cm So the `units` variable should be named that way to accommodate.
- wodenokoto 5y agoI also spend way to long looking at the `UnitRegister()` and `ureg` class and object names. I'm not a fan of either. To the point where I'm wondering about the feasibility of having the API work like: from pint.default import meter, cm length = 3 * meter + 4 * cm
- kzrdude 5y agofrom pint.units import meter, cm :) Or whatever you fancy! I'm just someone in the comment section after all.