Skip to main content

('Tools for stack-usage in Python expressions',)

Project description

This small utility package provides functions to be used inside Python expressions that provide functionality like that available in stack-based languages (such as forth and postscript).

It registers a hidden variable in the current running frame, which is a plain Python list - calls to plain “push, pop, dup, retr”, etc… will just push/recover elements from that list.

The intent is that whenever in an expression a value is complicated to retrieve - (or computationally extensive) - instead of having to retrieve it in a previous line and storing said value in a variable, one gets the ability to “push” the value in this implicit stack - and retrieve it in another part of the same expression:

result = pop().upper() if not push(get_my+expensive_value()).isdigit() else pop()

For conveninece, most functions return the valued passed to them in the first place (like the push above).

Possibly in the future a decorator could be provided to modify the bytecode of calling the functions defined in here to make use of the actual value stack running inside the Python VM. Then this will be fun

João S. O. Bueno <jsbueno@simplesconsultoria.com.br>

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

stackfull-0.9.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file stackfull-0.9.tar.gz.

File metadata

  • Download URL: stackfull-0.9.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for stackfull-0.9.tar.gz
Algorithm Hash digest
SHA256 a228f7180dc5c61ba07aa934443997d0ca586917a1aa16117a975a435317094a
MD5 b687da2cf5ae1d91d19025cad49a4b93
BLAKE2b-256 271a9975ce34787b399dec0602d79b884bfb2c21d16f3c2968727bba368f84b4

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