<p><span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> a common approach I&#39;ve seen in various libraries (rather than languages specifically) is to have unit types as something you multiply by, matching how it works in maths itself.</p><p>e.g. in astropy you get a Unit type and a Quantity type, and multiplying a scalar by a Unit gives you a Quantity, such as 30*u.Hz = Quantity(30,Hz)</p>
Reply