class Distance(**kwargs)
[source]
To initialize a distance object, pass in a keyword corresponding to the desired unit attribute name set with desired value. For example, the following creates a distance object representing 5 miles:
1 | >>> dist = Distance(mi = 5 ) |
-
__getattr__(unit_att)
Returns the distance value in units corresponding to the given unit attribute. For example:
1 2 | >>> print (dist.km) 8.04672 |
-
classmethod unit_attname(unit_name)
Returns the distance unit attribute name for the given full unit name. For example:
1 2 | >>> Distance.unit_attname( 'Mile' ) 'mi' |
Please login to continue.