Q pint, how to override the prefix micro-that will be written µ-, not u-? Both are aliases when defining units, but when receiving a short character such as a format specification {:~}, it pintreturns to u-even when I try to override micro- = 1e-6 = µ-:
In [155]: ureg.define("micro- = 1e-6 = µ-")
WARNING 2016-01-06 15:19:07,017 unit._adder:563: Redefining 'micro' (<class 'pint.definitions.PrefixDefinition'>)
WARNING 2016-01-06 15:19:07,017 unit._adder:563: Redefining 'µ' (<class 'pint.definitions.PrefixDefinition'>)
(Please note that these warnings are apparently issued through the logging module and are displayed due to the rules in mine .pythonrc, logging.basicConfig(format=("%(levelname)-8s %(asctime)s %(module)s.%(funcName)s:%(lineno)s: %(message)s"), level=logging.DEBUG))
In [156]: x = 3 * ureg.micrometre
In [157]: ureg._get_symbol("micrometer")
Out[157]: 'um'
In [158]: "{:~}".format(x)
Out[158]: '3 um'
How to override the micro-registry entry to "{:~}".format(x)provide me 3 µm, not 3 um?
Edit
I use pintfrom the latest git repository:
In [161]: print(pint.__version__)
0.7.dev0
Edit 2
, , u-:
In [3]: ureg = pint.UnitRegistry()
In [4]: q = 12 * ureg.um
In [5]: ureg.define("micro- = 1e-6 = µ-")
WARNING 2016-01-06 15:41:25,477 unit._adder:563: Redefining 'micro' (<class 'pint.definitions.PrefixDefinition'>)
WARNING 2016-01-06 15:41:25,477 unit._adder:563: Redefining 'µ' (<class 'pint.definitions.PrefixDefinition'>)
In [6]: x = 3 * ureg.micrometre
In [7]: "{:~}".format(x)
Out[7]: '3 um'
( ):
In [7]: x = 3 * ureg.micrometre
In [8]: "{:~}".format(x)
Out[8]: '3 µm'
, u-.