[Python-ideas] SI scale factors in Python

Nick Coghlan ncoghlan at gmail.com
Thu Aug 25 22:19:53 EDT 2016


On 26 August 2016 at 06:06, Ken Kundert <python-ideas at shalmirane.com> wrote:
> Here is a fairly typical example that illustrates the usefulness of supporting
> SI scale factors and units in Python.

Ken,

To build a persuasive case, you'll find it's necessary to stop
comparing Python-with-syntactic-support to
Python-with-no-syntactic-support-and-no-third-party-libraries, and
instead bring in the existing dimensional analysis libraries and
tooling, and show how this change would improve *those*.

That is, compare your proposed syntax *not* to plain Python code, but
to Python code using some of the support libraries Steven D'Aprano
mentioned, whether that's SymPy (as in
http://docs.sympy.org/latest/modules/physics/unitsystems/examples.html
) or one of the other unit conversion libraries (as in
http://stackoverflow.com/questions/2125076/unit-conversion-in-python )

It's also worth explicitly highlighting that the main intended
beneficiaries would *NOT* be traditional software applications (where
the data entry UI is clearly distinct from the source code) and
instead engineers, scientists, and other data analysts using
environments like Project Jupyter, where the code frequently *is* the
data entry UI.

And given that target audience, a further question that needs to be
addressed is whether or not native syntactic support would be superior
to what's already possible through Jupyter/IPython cell magics like
https://bitbucket.org/birkenfeld/ipython-physics

The matrix multiplication PEP
(https://www.python.org/dev/peps/pep-0465/ ) is one of the best
examples to study on how to make this kind of case well - it surveys
the available options, explains how they all have a shared challenge
with the status quo, and requests the simplest possible enabling
change to the language definition to help them solve the problem.

One potentially fruitful argument to pursue might be to make Python a
better tool for teaching maths and science concepts at primary and
secondary level (since Jupyter et al are frequently seen as
introducing too much tooling complexity to be accessible at that
level), but again, you'd need to explore whether or not anyone is
currently using Python in that way, and what their feedback is in
terms of the deficiencies of the status quo.

Regards,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list