-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defining a unit a second time does not override the original definition #740
Comments
Indeed, we do not check if the cache is still valid as it would add an unnecessary toll only needed when redefining units (which is a rare practice anyway). A few comments though
|
And why not just leave the current behaviour and provide a public API for explicitly rebuilding the cache? It could be a |
I would argue that if you redefine a unit, rebuilding the cache should be the default and not rebuilding should be optional. |
I agree with @hgrecco
|
I also agree with @hgrecco. Side note: After some refactoring of my code, I have overcome the need to redefine units in the same unit-registry. So this issue does not cause me troubles anymore (just so the priority is realistic). |
Hey guys,
First off, thank you for building pint! Its simplicity and power are a pleasure to work with. :)
I recently stumbled on a use-case where I do the following:
The redefinition does not work.
See for instance:
A bit of debugging led to the
_get_root_units
method in the fileregistry.py
. In this line, if a conversion is cached, its cached value is returned. Plus, I couldn't find a way to not use the cache.I'm sorry if I've missed a workaround.
The text was updated successfully, but these errors were encountered: