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

Uploaded Source

File details

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

File metadata

  • Download URL: mathfuncs-parse-1.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 c0092ef50f0037120825ff9fbb9ac4d12b74eced1a0eaba313beee92f9083e13
MD5 0d0ec6519f8b7b50e37aea9298174bff
BLAKE2b-256 a4ffc8004bfc0e24058a6c5a2323a9fe37fceeb2860f194a7d01ee431d2045fb

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