Skip to main content

A package for units.

Project description

AllYourUnitAreBelongToUs

Installation

pip install ayuabtu

Using

Creating quantities

Creating a quantity with a given unit:

>>> from ayuabtu.quantities import Length
>>> from ayuabtu.units import LengthUnit
>>> Length(2, LengthUnit.METER)
2 m

or you can use the unit specific factory method:

>>> from ayuabtu.quantities import Length
>>> Length.FromMeters(2)
2 m

Converting units

>>> from ayuabtu.quantities import Length
>>> from ayuabtu.units import LengthUnit
>>> Length(2, LengthUnit.METER)
>>> distance_metric = Length.FromMeters(2)
>>> distance_metric.to_unit(LengthUnit.FOOT)
6.561679790026246 ft

Custom Units

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ayuabtu-0.0.1.tar.gz (6.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page