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

Automatic construction of unit label via * and / operations #45

Open
domspad opened this issue Nov 12, 2015 · 0 comments
Open

Automatic construction of unit label via * and / operations #45

domspad opened this issue Nov 12, 2015 · 0 comments

Comments

@domspad
Copy link

domspad commented Nov 12, 2015

Given two units with defined labels, infer a new label when two units are multiplied or divided. Especially useful for user-defined units

from scimath.units.time import hour
from scimath.units.length import cm
hour.label = 'hr'
cm.label = 'cm'
cm_per_hour = cm / hour
print cm_per_hour.label # Currently '', but would be ideally 'cm/hr'
print cm_per_hour # '2.77777777778e-06*m*s**-1'

The behavior here isn't completely well defined, such as when we come to say units dealing with the same object of measure (e.g. m / cm shouldn't be 'm/cm'), but at the same time some user facing applications would rather not see 2.777777777777778e-06*m*s**-1

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

No branches or pull requests

1 participant