3 ms·
ureg = pint.UnitRegistry() 3 * ureg.meter + 4 * ureg.cm Why is this an object? Shouldn't this be static?
by bjt2n3904 5y ago
ureg = pint.UnitRegistry()
3 * ureg.meter + 4 * ureg.cm
Why is this an object? Shouldn't this be static?
- hprotagonist 5y agothis is python: what’s this “static” thingie?
- nerdponx 5y agoI assume it gives you the ability to manipulate the unit registries, work with multiple registries in the same application, etc. Mutable state is one thing, but holding the mutable state in a non-global user-facing object is better than keeping it global and hidden.