Closed aulemahal closed 2 days ago
Failure is real.
I've been a bit away from pint
, so I'll have to first look into how it changed in the most recent version before giving any thorough reviews, but at a quick glance this looks fine.
but at a quick glance this looks fine.
Thanks! no need for a thorough review.
Fixes #522 and hgrecco/pint#2024.
pint.formatter
call changes according to the installed version ofpint
.f"{u:cf}"
andf"{u:~cf}"
returned the same thing except for "dimensionless". This shortening is done explicitly in the new formatter with aif-else
in case it was already done bypint
.try-except
was a legacy from something else.I tested this with pint 0.24.1 and 0.23. I also did a very minimal test with pint 0.22 down to 0.12. This seems to support pint >= 0.18, like the previous version did.
With pint < 0.24 the only difference this makes is that dimensionless units are returned as
""
with{u:cf}
and{u:~cf}
, where as the previous version returned"dimensionless"
for{u:cf}
.