Simple library for evaluating mathematical formulas.
Project description
formparse
Simple library for evaluating mathematical formulas.
Written as an safe alternative to Pythons eval() function the aim was to provide a lightweight library that could evaluate mathematical formulas provided by users in a safe way.
Installation
You can install this package unsing pip:
pip install formparse
SECURITY WARNING!
Usage
from formparse import Formula
formula = Formula('3*x**2')
result = formula.eval({'x': 2})
Alternatives
numexpr:
numexpr is a Python library for numpy that accelerates array operations but it can hadnle simple string calculations as well. It is therefore a lot bigger than formparse but if you are using numpy anyways in you project or need additional features that we do not provide this might be a good fit. Check out its repo here .
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
Built Distribution
Hashes for formparse-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 977da561e0c9655de6a42d491df0d9f034e2a998a109b4143aec96491705a37b |
|
MD5 | 8f788410a3948f2eb1ca5fb9d479ab40 |
|
BLAKE2b-256 | 0b04374efb08a1514bd7904719b2bc5a8d47daa8522e0d131d78abb4a48d3907 |