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

Support degree sign #449

Closed
iamthad opened this issue Nov 1, 2016 · 1 comment
Closed

Support degree sign #449

iamthad opened this issue Nov 1, 2016 · 1 comment

Comments

@iamthad
Copy link
Contributor

iamthad commented Nov 1, 2016

The degree sign should be supported.

Current behavior:

>>> import pint
>>> units = pint.UnitRegistry()
>>> Q_ = units.Quantity
>>> Q_('90°')
<Quantity(90, 'dimensionless')>

Expected behavior:

>>> import pint
>>> units = pint.UnitRegistry()
>>> Q_ = units.Quantity
>>> Q_('90°')
<Quantity(90, 'degree')>

It does not appear to be possible to just define the degree sign as a unit alias in the unit registry, possibly because the degree sign is not letter-like.

iamthad pushed a commit to iamthad/pint that referenced this issue Nov 1, 2016
@hgrecco
Copy link
Owner

hgrecco commented Nov 17, 2016

Indeed this is due to the fact we use the python tokenizer. Same problem with #429. I would like to see a better way to dealing with all these things.

bors bot added a commit that referenced this issue Mar 31, 2017
450: Implement degree sign handling to resolve #449 r=hgrecco
@hgrecco hgrecco closed this as completed Apr 2, 2017
znicholls pushed a commit to znicholls/pint that referenced this issue Aug 29, 2018
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

No branches or pull requests

2 participants