On Sat, Apr 9, 2022 at 5:52 AM Steven D'Aprano <steve@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