magically import evaluated math expressions
Project description
magic-math
Magically import evaluated math expressions. Like so:
from magic_math import TEN_TIMES_FIVE_DIVIDED_BY_TWO
from magic_math import FIVE_TIMES_FIVE
from magic_math import TWO_HUNDRED_MINUS_TEN
from magic_math import SIX_HUNDRED_AND_SIXTY_SIX_DIVIDED_BY_TWO_TIMES_EIGHT
from magic_math import OPEN_FIVE_MINUS_THREE_CLOSE_TIMES_TEN
ABC=7
from magic_math import OPEN_TEN_MINUS_OPEN_ABC_DIVIDED_BY_TWO_CLOSE_CLOSE
print(f"{TEN_TIMES_FIVE_DIVIDED_BY_TWO = }") # 25.0
print(f"{FIVE_TIMES_FIVE = }") # 25.0
print(f"{TWO_HUNDRED_MINUS_TEN = }") # 190.0
print(f"{SIX_HUNDRED_AND_SIXTY_SIX_DIVIDED_BY_TWO_TIMES_EIGHT = }") # 2664.0
print(f"{OPEN_FIVE_MINUS_THREE_CLOSE_TIMES_TEN = }") # 20.0
print(f"{OPEN_TEN_MINUS_OPEN_ABC_DIVIDED_BY_TWO_CLOSE_CLOSE = }") # 6.5
Notes:
- All returned values are in floating point form
- Floats can be specified using "point" or "dot"
- Variables are partially supported, currently only within scripts
- Uses basic postfix order of precendence
- Basic parenteses syntax using
OPENandCLOSEvalues
Credits:
- Inspired by and uses code from David Buchanan's
magic-numberspackage
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
magic_maths-0.1.0.tar.gz
(5.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magic_maths-0.1.0.tar.gz.
File metadata
- Download URL: magic_maths-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
259bd475dac9579b77d5b00b1e6e6984d9a29a5ea886da7965aacb8b65df5e26
|
|
| MD5 |
efc9c4ab86ded4f177f89648d6ffa431
|
|
| BLAKE2b-256 |
b7d78ffd7401fc469be27d760016c840996a3703546e6cf8b6b269ecd5918400
|
File details
Details for the file magic_maths-0.1.0-py3-none-any.whl.
File metadata
- Download URL: magic_maths-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bb4c33f9c6bd1882214aee68b8dfea5e1b7cf47587c1a7f8c1897bb29d48373
|
|
| MD5 |
4fe4f5223cace3bf6cba76e1db733f4a
|
|
| BLAKE2b-256 |
4407558f28de2b3ac2867893274d15c4527199a7e1508dc878a159671a389091
|