etuples
Python S-expression emulation using tuple-like objects.
What it is and what it does
etuples provides a Python implementation of S-expressions—a Lisp-like notation where code and data are both represented as nested lists—using tuple-like objects. Each etuple wraps an operator (typically a callable) and its operands, and can be evaluated to produce a result. The package caches evaluation results so repeated access to the same etuple returns the same cached object, and tuple operations like slicing preserve both the etuple structure and its cached evaluation.
The package is built on multipledispatch, allowing you to extend rator (operator extraction), rands (operand extraction), and apply (operation application) to work with custom types beyond built-in etuples. This makes it useful for symbolic computation, expression trees, and meta-programming tasks where you need to manipulate and evaluate nested function calls as first-class data structures.
Use it for:
- Build symbolic computation systems where mathematical or logical expressions are data structures that can be inspected, transformed, and evaluated.
- Implement expression trees for domain-specific languages or interpreters that need to represent and evaluate nested operations.
- Create meta-programming tools that treat function calls as composable, cacheable objects rather than immediate evaluations.
- Extend custom node types (like AST nodes) to work with a unified operator/operand extraction and application interface.
- Prototype Lisp-like or functional programming patterns in Python while maintaining tuple compatibility.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides S-expression emulation using tuple-like objects that can be evaluated, cached, and extended with custom operators via multipledispatch.
Yes, if you need S-expression-like symbolic computation in Python. The package is lightweight, has no security vulnerabilities, and carries a permissive license. The aging maintenance status (396 days since last release) is a minor concern for a stable library, but the recent repository activity and lack of open issues suggest it is not abandoned. Install it for expression trees, symbolic manipulation, or meta-programming; skip it if you only need standard tuple operations.
Install
etuples on PyPI
pip
pip install etuplesuv
uv add etuplespoetry
poetry add etuplesInstalling etuples
Before you install
Low friction: pure Python wheel with only two runtime dependencies (cons and multipledispatch). Last release was recent and the repository is actively maintained, though the project shows aging status with no release in the past 396 days.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most projects.
Quickstart
pip install etuples
from operator import add
from etuples import etuple
et = etuple(add, 1, 2)
print(et.evaled_obj) # 3
Requires Python 3.9 or later; CPython and PyPy are both supported.
Verify before relying
- Whether the caching mechanism scales well with deeply nested or large expression trees.
- Performance characteristics compared to native Python evaluation for typical use cases.
- Whether the multipledispatch extension system is documented with real-world examples beyond the basic Node case.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — cons, multipledispatch |
| Maintenance | aging — 396 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,278,094/month — #4,121 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: etuples-0.3.10-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
sexpdataParses and serializes S-expressions (Lisp-style…
permissive · top 15,000 on PyPI
snuggsSnuggs evaluates s-expressions (Lisp-like…
permissive · top 15,000 on PyPI
cobbleCobble is a Python library for creating data…
permissive · top 5,000 on PyPI
LazifyLazify provides lazy evaluation utilities for…
permissive · top 15,000 on PyPI
multipledispatchEnables functions to dispatch on the types of…
permissive · top 5,000 on PyPI
flatten-dictConverts nested dictionaries into flat…
permissive · top 5,000 on PyPI
dask-exprDask Expressions provides query optimization…
permissive · top 5,000 on PyPI
common-expression-languageEvaluates Google's Common Expression Language…
permissive · top 15,000 on PyPI
lensesLenses provides a functional approach to…
copyleft · top 15,000 on PyPI