Classes to help with common types of measurements
Project description
Measuring Tools
A Python Module to help deal with measurments in an object oriented way.
An Object can be converted from one measurment to another.
from measuring_tools.length import Length
# Convert From One Length To Another
length1 = Length(value=1, measurement='yards')
length2 = length1.to_meters()
print(length2)
# Output
Length(value=0.9144, measurement='meters')
Two objects are designed to interact with one another even if measurments are different.
Example:
from measuring_tools.length import Length
# Two Lengths - One In Meters, One In Yards
length1 = Length(value=1, measurement='meters')
length2 = Length(value=1, measurement='yards')
print(length1 + length2)
# Output
Length(value=1.9144, measurement='meters')
In the example above, length two is converted from yards to meters and then added to length1. The output is a new object separate from length1 and length2.
Inplace operations are also available.
from measuring_tools.length import Length
# Inplace Subtraction
football_field = Length(value=100, measurement='yards')
football_field -= 25
print(football_field)
# Output
Length(value=75, measurement='yards')
In the example above, the value of football_field is modified directly. The output is the same as object.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
measuring-tools-0.1.2.tar.gz
(7.3 kB
view hashes)
Built Distribution
Close
Hashes for measuring_tools-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95ec2c4647e01c559144adbb69e4b3f3f352ad20865ce2e972c0b0126e756ea9 |
|
MD5 | 9ddf70041422d5054b197af731e78c90 |
|
BLAKE2b-256 | b4668286b6b6febe2d98797cd4bf13932ff6c4fe6420acb1748d86d690d78734 |