There is a useful recent feature in python allowing one to print a variable's name and its value: https://stackoverflow.com/a/57225950/6843348. This doesn't quite work with the uncertainties
library's ufloat
type, because the representation is printed, losing the formatting. Any suggestion to work around this?
from uncertainties import ufloat
x = ufloat(1.8768768, 0.0039788594)
print(x) # OK: 1.877+/-0.004
print(repr(x)) # 1.8768768+/-0.0039788594
print(f"{x=}") # Not OK: x=1.8768768+/-0.0039788594
EDIT Would prefer to enter the var name only once, and keep ufloat's formatting