Skip to main content

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

Project description

  • 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 objects 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.1.tar.gz (181.3 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: mathfuncs-parse-1.1.1.tar.gz
  • Upload date:
  • Size: 181.3 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.1.tar.gz
Algorithm Hash digest
SHA256 8a3d001adcfa37714b0488cee10bb9dba09d140c84fefb3f783e3d169b137d85
MD5 c8256cc73f03f56e014e2146578aae2f
BLAKE2b-256 041878c2380e0e24e27bdd9eb71bfba19e11bdad11eb7d3937870592f7abc5d7

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