py-mactypes manual | 4. Units class

#

## 4. The `Units` class

The `Units` class represents a measurement of some sort, e.g. 3 inches, 98.5 degrees Fahrenheit.

    class Units

        Constructor:

            Units(value, type)
                value : int | float -- the amount, e.g. 3.5
                type : str -- the unit of measurement, e.g. 'centimeters'

        Properties:

            value : int | float -- returns the amount

            type : str -- returns the unit of measurement

The following unit types are defined as standard:

    'centimeters'                  'cubic_inches'
    'meters'                       'cubic_feet'
    'kilometers'                   'cubic_yards'
    'inches'
    'feet'                         'liters'
    'yards'                        'quarts'
    'miles'                        'gallons'

    'square_meters'                'grams'
    'square_kilometers'            'kilograms'
    'square_feet'                  'ounces'
    'square_yards'                 'pounds'
    'square_miles'
                                   'degrees_Celsius'
    'cubic_centimeters'            'degrees_Fahrenheit'
    'cubic_meters'                 'degrees_Kelvin'

Additional application-specific unit types can be added if needed.

### Examples

    mactypes.Units(14, 'inches')

    mactypes.Units(3.5, 'square_meters')