On Sat, Apr 9, 2022 at 5:52 AM Steven D'Aprano <st...@pearwood.info> wrote:

> > Python is so painful to use for units I've actually avoided it,


What have you tried? and what do you do instead?

MathCAD, maybe?

For my part, there is a bit of a barrier to entry: I need to pick a
library, I need to get over the learning curve, etc. But I dont think
having it as a Python built in would help much.

Another BIG barrier for me is that in my real work, I need to do a lot of
things with units that aren't strictly correct:

equivalence of weight and mass
(kg and lbs)

equivalence of mass per volume and unitless (ppm and micrograms/liter)

Really strange "units" like API Gravity, and slightly less ones like
Specific Gravity

These are all awkward to deal with ain a proper unit system that is
specifically intended to not let you make these kinds of "errors".

And a system that worked well for my line of work would likely be a
disaster for others'

So what barriers do you have?

Also -- as someone has mentioned on this list -- nifty easy syntax would
help mostly for scripting and "using Python as a calculator" -- so a
plug-in for Jupyter or and a calculator application of some sort might be
almost as good as built-in syntax. And the downsides of carrying units
around with the built in numbers (overhead, numpy incompatibility)  is
substantial, and would be irrelevant.

finally: give PInt a try -- it really is pretty nifty -- particularly in a
notebook:

https://colab.research.google.com/github/agile-geoscience/xlines/blob/master/notebooks/13_Physical_units_with_pint.ipynb

-CHB
-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/F6O2GODFN6P3NF7GKO7I2MF3QOY2UI76/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to