4 ms·
I second the appreciation of the lib name, and can relate to the "I programmed Pint to scratch my own itches" line, but how does it compare to Sympy? I feel lik
by zdkl 5y ago
I second the appreciation of the lib name, and can relate to the "I programmed Pint to scratch my own itches" line, but how does it compare to Sympy?
I feel like when you must deal with units, integration with other mathematical tools is indispensable. So while I guess numpy integration is more than good enough on that front, is this lib's api enough of an improvement over Sympy's to forego all the niceties the latter incorporates?
https://docs.sympy.org/latest/modules/physics/units/index.html https://docs.sympy.org/latest/modules/physics/units/index.ht...
(edit: I'm very biased; Sympy's docs and code gave me a lot of fundamental mathematical intuitions -in python- that my education hasn't.)
- nemetroid 5y agoIt's nice to have as small dependencies as possible. If Pint provides everything your project needs, buying into the complete Sympy ecosystem is just a complexity cost.
- riedel 5y agoHaving used sympy for rather simple task I wonder how much cost sympy really adds. Can you elaborate? It seems to me that symbolic evaluation and unit conversuin are not too far apart and buying into this ecosystem was never a big tech debt in my eyes. (Unlike maybe scipy or numpy)
- andy_ppp 5y agoEvery dependency adds complexity to your project, you might never notice it because the abstractions are water tight (for your use-case) but it’s there.
- riedel 5y agoYes but pint seems to add numpy and dask from a quick check. How is sympy worse? And maintaining sth yourself for sure adds complexity.
- gcthomas 5y agoFrom the documentation: Dependency free: it depends only on Python and its standard library. It interacts with other packages like numpy and uncertainties if they are installed
- riedel 5y agoOh I guess I looked into some build dependencies because there were actually none . This is actually a good thing more libraries should do. So I guess the only downside would be that potentially versioned dependencies/breaking changes need to be managed one level above if you want to use those parts. Is there actually a good way manage "supported" optional dependencies in python?
- dfee 5y agoGreat docs. This would have made an indispensable tool in college. (Also, though, I took physics before I started CS, so I really didn’t know my way around basic programming).
- JBorrow 5y agoIf you want a python unit system that is backed by sympy you can use `unyt`: https://unyt.readthedocs.io/en/stable/ https://unyt.readthedocs.io/en/stable/