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

Provides trait types that support unit groups #32

Open
itziakos opened this issue Jun 10, 2014 · 0 comments
Open

Provides trait types that support unit groups #32

itziakos opened this issue Jun 10, 2014 · 0 comments

Comments

@itziakos
Copy link
Member

It would be convenient if we could define TraitTypes that validate units based on the a quantity

e.g.

from scimath.units.length import Length, feet, meters
from scimath.units.mass import kg

class MyClass(HasTraits):

     unit = Length(feet)

my_class = MyClass()

# This is valid
my_class.unit = meters

# This is invalid
my_class.unit = kg

The trait might be as simple as an Enum with all the available unit objects.

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