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
Installation
python3 -m pip install magic-maths
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.1.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.1.tar.gz.
File metadata
- Download URL: magic_maths-0.1.1.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 |
674c9e3d9dc23cb7bb9090a0086974e32dd96bd1287dbda351cbaeddcf0e4efb
|
|
| MD5 |
8aaf19267685272eae841a4774f0a6b5
|
|
| BLAKE2b-256 |
230d1d147c70cee1dcdddc249f83e79397d6d9dd6a8e25c02711b1a9ae821705
|
File details
Details for the file magic_maths-0.1.1-py3-none-any.whl.
File metadata
- Download URL: magic_maths-0.1.1-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 |
3f27f7c3365ae4600192cb7f615f3e06d076dea3a50dadcde85937f09e6de0b3
|
|
| MD5 |
5efed11454f9068488c4aa41e616cc65
|
|
| BLAKE2b-256 |
a1910685eb158add51aa785df64b284eb3c6cc0dc747e3915e992f63b9ffc1e7
|