Skip to main content

Pygritia: Lazy Symbolic Evaluation

Project description

Pygritia

Pygritia is a symbolic expression library.

It can

  • create symbolic expressions with one or more symbols
  • resolve symbolic expressions by substituting values to symbols
  • partially resolve symbolic expression

Example:

from pygritia import symbol, evaluate, update

this = symbol('this')
that = symbol('that')
arr = [1, 2, 3]
print(5 / this + 2 * 6)  # 5 / this + 12
print(evaluate(5 / this + 2 * 6, this=2))  # 14.5
print(evaluate(this[that], this=arr)) # [1, 2, 3][that]
update(this[that], 42, this=arr, that=1)
print(arr)  # [1, 42, 3]

Documentation of all public functions can be found in pygritia

Project details


Download files

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

Files for pygritia, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pygritia-0.2.0-py3-none-any.whl (14.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pygritia-0.2.0.tar.gz (61.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page