pint
pint copied to clipboard
Use of Planck constant symbol is inconsistent
Regarding https://github.com/hgrecco/pint/pull/1454, I think the usage of ℎ
as a symbol for Planck's constant is inconsistent (and inconvenient for my own usage, but I guess that's my problem). I already mentioned it in https://github.com/PainterQubits/Unitful.jl/issues/536#issuecomment-1225847077 without realizing that was a different project, so I thought I'd repeat it here.
Basically, if you change h
to ℎ
, you should also change ħ
to ℏ
, e
to 𝑒
(elementary charge), G
to 𝐺
(gravitational constant), etc. But my opinion is that these italic codepoints should not exist at all.
I guess the most convenient (and consistent) way would be a separate namespace for constants, as described in https://github.com/hgrecco/pint/issues/1078#issuecomment-950231900
For the record: https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
Problems occurs with clashing keys & string parsing. We cannot have both clashing of keys & string parsing of constants. Even with different namespaces, that's the weakness of dealing with strings only with parsing functions.
I'm not against using unicode for widely used constants since that's how they are printed in the literature (e.g. planck constant, gravital constants, light speed) and how you can differentiate from units. (see BIPM brochure about this).
Anyone got the ISO 80000-1 to see the chapter about constants, I wonder what they say about it.
About the use with namespaces, I really like the idea. Though if you want to keep the use of constants parsing in strings, strict no clashing policy need to be observed.
@Jellby, I think we can all agree h
should be kept for hours, this is the standard symbol for it & I don't see us moving back on this change.
For those constants, I think using specific unicode & long version name should be enough when dealing with text.
@jules-ch Indeed, I'm not suggesting to change the symbol for hours, but using the italic codepoint for Planck's constant only is inconsistent. For convenience and text parsing, there could be "shorthand" aliases , e.g. h_
or \h
(and the same for other constants, which would allow using e
for Euler's number and G
for Gauss, if you wish...).
I agree with @keewis The most straightforward way is finally having the constants group!