Skip to content
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

Compact #224

Merged
merged 8 commits into from
Feb 13, 2015
Merged

Compact #224

merged 8 commits into from
Feb 13, 2015

Conversation

ryanpdwyer
Copy link
Contributor

  • Adds a to_compact method to Quantity, as discussed in Support for normalization #151.
  • Adds infer_base_units, a helper method used by to_compact, to utils.
  • Adds tests of to_compact

@hgrecco
Copy link
Owner

hgrecco commented Jan 13, 2015

While I am definitely +1 on adding the compact method that you propose I am not happy about hardcoding the prefixes (and in 2 places). You can access all the prefixes from the registry. To get the unprefixed name we could modify get_name to have an extra parameter (strip_prefix?) or similar defaulting to the current behavior.

This is not just a aesthetic choice. Is part of Pint design philosophy to avoid hardcoded values and making everything part of the registry.

Additionally, this will also help when we try implement this compact for non SI units, but this are future plans when systems are fully implemented.

@hgrecco
Copy link
Owner

hgrecco commented Feb 6, 2015

Sorry but only now this came again to my attention. It looks really good. I will merge it next week.

@hgrecco
Copy link
Owner

hgrecco commented Feb 13, 2015

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants