Skip to main content

A small module for parsing and evaluating expressions of any number of variables

Project description

How to Use:

After importing ‘mathfuncs_parse’, create a ‘mathfuncs_parse.func(expr: str)’ object.

Available Member Functions:

  • valid() -> bool Checks whether the expression is syntactically correct.

  • eval() -> float Evaluates the expression. Note: only works if no variables are present.

  • eval(vars: dict{str: float|int}) -> float Evaluates the expression, substituting the variables present with the values passed in the dict.

  • vars() -> dict{str: float} Returns a dict containing all variables that must be passed to eval().

  • add_func(name: str, func: <functionObj(float) -> float>) -> Null Adds a user-defined function to the object’s internal state. Note: calling ‘init(str)’ does not reset this.

  • avail_funcs() -> dict{str: <functionObj>} Returns a dict of available functions which can be used in the current expression.

Release Note (1.1.3):

  • Updated compiler flag detection for building source wheels on most platforms

  • Small bug fixes for greater cross-platform compatibility

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mathfuncs-parse-1.1.4.tar.gz (181.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mathfuncs_parse-1.1.4-cp311-cp311-win_amd64.whl (90.9 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file mathfuncs-parse-1.1.4.tar.gz.

File metadata

  • Download URL: mathfuncs-parse-1.1.4.tar.gz
  • Upload date:
  • Size: 181.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for mathfuncs-parse-1.1.4.tar.gz
Algorithm Hash digest
SHA256 9c7f2b029301b616e47d2d8cf5b2ea9346b3f0d4737de9e39e58306bc05a3151
MD5 7fa78d4c671ce8cebd0ec06cd01bff91
BLAKE2b-256 823ccee1a611219766499dcbe15ea824967439fa4cda4cfd98244c1a7f43d63c

See more details on using hashes here.

File details

Details for the file mathfuncs_parse-1.1.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for mathfuncs_parse-1.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6168754b50bb64eacc430ceb3e426f1c7c5831383755d9aa608f8c4d884b59df
MD5 c8278bd723279cf62ce7a3c21a299d17
BLAKE2b-256 78981bc05fcec3ba1c8e3cb8116f5e8ca46c93907ebc20181d6c92ff09141429

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page