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.

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.2.tar.gz (181.2 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.2-cp311-cp311-win_amd64.whl (90.1 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

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

File metadata

  • Download URL: mathfuncs-parse-1.1.2.tar.gz
  • Upload date:
  • Size: 181.2 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.2.tar.gz
Algorithm Hash digest
SHA256 7b170e7a7f9c3acc8c2a96beef655de11b644d7cebb0b7937cdcd9e9db820aa7
MD5 d2d43cd9e88f02bf944db064eed0d2cc
BLAKE2b-256 51f0d54868cca51890ec70cd715738c399672af66a8d4ed2f9a5cc3b1bb0e5fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mathfuncs_parse-1.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 35caa4fb33b30b66c8fdae5410a343adc8fe3e081d86c6f9aeb4be9ac8898d1f
MD5 7db88473e0b63824d09dfc46ece6f2a6
BLAKE2b-256 8c44c9478b03b4f5c5d417dbbca533eb427c10dc09dc5645ce7e2f22fd602b2b

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