4 ms·
IMO using operator overloading for this kind of thing makes it hard to read, since I have to be extra careful to mentally parse whether that `*` is a multiplica
by ahupp 3y ago
IMO using operator overloading for this kind of thing makes it hard to read, since I have to be extra careful to mentally parse whether that `*` is a multiplication or units, remember what variables are in scope etc. Notation matters, and if I didn't care about that I'd just write `pint.Quantity(5, "meters/second")` and be done with it. Or more likely, not go to the trouble of using them at all.
> I don’t understand why you’d go to the enormous trouble
But more importantly, it was just really fun to get it working.
- dragonwriter 3y ago> IMO using operator overloading for this kind of thing makes it hard to read, since I have to be extra careful to mentally parse whether that `*` is a multiplication or units Units are inherently exactly multiplication. 5 meters is: 5 (unitless) * (1) meter
- ahupp 3y agoYes. There are many (infinitely!) ways to write an equivalent expression, most of which are not as clear to read as the standard format.