{ "info": { "author": "Jo\u00e3o S. O. Bueno", "author_email": "gwidion@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "License :: OSI Approved :: Python Software Foundation License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "PYTHON STACKFULL\n================\n\nThis small utility package provides functions to be used\ninside Python expressions that provide functionality\nlike that available in stack-based languages\n(such as forth and postscript).\n\nIt registers a hidden variable in the current\nrunning frame, which is a plain Python list -\ncalls to plain \"push, pop, dup, retr\", etc...\nwill just push/recover elements from that list.\n\nThe intent is that whenever in an expression\na value is complicated to retrieve - (or \ncomputationally extensive) - instead of\nhaving to retrieve it in a previous line\nand storing said value in a variable,\none gets the ability to \"push\" the value\nin this implicit stack - and retrieve it\nin another part of the same expression::\n \n `result = pop().upper() if not push(get_my+expensive_value()).isdigit() else pop()`\n\nFor convenience, most functions return the valued passed\nto them in the first place (like the push above).\n\n\nCompatibility\n==============\nAs of version 0.20, and introduction of the `window`\nfunction, stackfull is no longer Python 2.x compatible.\n\n\nAvailable functions:\n====================\n\nclear\n_____\n\n Clears the stack\n\n\ncleartomark\n___________\n\n Clears the stack up to the special sentinel value\n MARK - this allows for clean-up of the stack after\n a block of code, preserving the older values.\n If the stack is not empty, returns the last value on the\n stack non destructively, else, MARK itself is returned.\n\n\ndiscard_if_false\n________________\n\n Removes the last value in the stack if the expression is false.\n Made to be used in comprehensions, in the if part:\n\n Ex.:\n [pop().name for image in values if pop_if_false(push(image) is not None)]\n\n\n\ndup\n___\n\n Dplicates the last value on the stack\n It also returns the value duplicated in a non-destructive way\n\n\npop\n___\n\n Pops the last value from the stack\n\n\npopclear\n________\n\n Pops the last value from the stack, and clears the stack.\n This allows stackfull to be used inside generator expressions\n and comprehensions, using a 'push' in the filtering expression,\n and 'popclear' on the result expression.\n\n\npush\n____\n\n Pushes a value into the stack, and returns the value itself\n Along with 'pop' and 'popclear' this is the heart of\n stackfull - as it allows an expensive function to be used\n in a 'if' or 'while' test, and still have its value\n available to use inside the defined block - without\n the need of an explicit auxiliar variable\n\n\npush_if_true\n____________\n\n Returns the value itself, and Pushes a value into the stack, if it\n is truthy. Otherwise does not touch the stack.\n Nice to use inside comprehensions\n in the \"if\" part: if the expession is not True, it is never pushed, and\n extraneous values don't pile up on the stack.\n\n Ex.:\n [pop().name for image in values if push_if_true(image)]\n\n\n\nretr\n____\n\n Peeks the last value on the stack without consuming it\n\n\nroll\n____\n\n Rolls the last 'items' values on the stack by\n 'amount' positions, changing their order.\n Returns the value on the top of the stack after\n the changes in a non destructive way.\n\n\nstack\n_____\n\n Retrieves the stack as an ordinary Python list\n (which it actually is), allowing one to perform\n extra desired operations, such as 'len' or 'insert'\n\n\nwindow\n______\n\n Pre-populates a frame stack with the seed values,\n and then iterates over the iterable -\n\n This allows one to use the stack with initial values in a simple way\n in a generator-expression context - like\n\n `fib = [push(stack()[-2] + stack()[-1]) for i in window(range(2, 10), 1,1)]`\n\n\n\nJo\u00e3o S. O. Bueno \n\n\nHelp on module stackfull:\n\nNAME\n stackfull - Stack expression utilities\n\nDESCRIPTION\n These functions use a \"hidden\" variable in the calling\n code frame context to hold a stack (a Python list)\n with values - the simple functionality here allow one\n have much of the functionality of stack\n based languages, like Postscript and Forth conveninently\n available to be used in any Python expression.\n \n \n (MAYBE) TODO: create a decorator which trasnform the operations here\n in real operations in the Python VM stack,\n by modifying the bytecode of calls to these utility functions into\n actual Python VM stack operations.\n\nFUNCTIONS\n clear()\n Clears the stack\n \n cleartomark()\n Clears the stack up to the special sentinel value\n MARK - this allows for clean-up of the stack after\n a block of code, preserving the older values.\n If the stack is not empty, returns the last value on the\n stack non destructively, else, MARK itself is returned.\n \n dup()\n Dplicates the last value on the stack\n It also returns the value duplicated in a non-destructive way\n \n pop()\n Pops the last value from the stack\n \n popclear()\n Pops the last value from the stack, and clears the stack.\n This allows stackfull to be used inside generator expressions\n and comprehensions, using a 'push' in the filtering expression,\n and 'popclear' on the result expression.\n \n push(value)\n Pushes a value into the stack, and returns the value itself\n Along with 'pop' and 'popclear' this is the heart of\n stackfull - as it allows an expensive function to be used\n in a 'if' or 'while' test, and still have its value\n available to use inside the defined block - without\n the need of an explicit auxiliar variable\n \n retr()\n Peeks the last value on the stack without consuming it\n \n roll(items, amount)\n Rolls the last 'items' values on the stack by\n 'amount' positions, changing their order.\n Returns the value on the top of the stack after\n the changes in a non destructive way.\n \n stack()\n Retrieves the stack as an ordinary Python list\n (which it actually is), allowing one to perform\n extra desired operations, such as 'len' or 'insert'\n\nDATA\n MARK = \n SN = '.stackfull'\n\nFILE\n /home/gwidion/projetos/stackfull/stackfull.py\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jsbueno/stackfull", "keywords": "python expressions stack acelerator utils push pop", "license": "License :: OSI Approved :: Python Software Foundation License", "maintainer": "", "maintainer_email": "", "name": "stackfull", "package_url": "https://pypi.org/project/stackfull/", "platform": "", "project_url": "https://pypi.org/project/stackfull/", "project_urls": { "Homepage": "https://github.com/jsbueno/stackfull" }, "release_url": "https://pypi.org/project/stackfull/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Tools for stack-usage in Python expressions", "version": "1.0.0" }, "last_serial": 4541030, "releases": { "0.10": [ { "comment_text": "", "digests": { "md5": "f94c7676e8670e6fc9dd1cd740c700a1", "sha256": "d4ec3c07af8477bd32de2a554e75bff7d1c018e05d281297fd0bc77e49591e43" }, "downloads": -1, "filename": "stackfull-0.10.tar.gz", "has_sig": false, "md5_digest": "f94c7676e8670e6fc9dd1cd740c700a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3944, "upload_time": "2016-09-12T15:51:04", "url": "https://files.pythonhosted.org/packages/1d/b6/cafdf7f9ddb8b3ba4ea3ccc085d7563358bd901e4933db3ecc2629be7f07/stackfull-0.10.tar.gz" } ], "0.20": [ { "comment_text": "", "digests": { "md5": "b942c09ea9e2f4405d1700ac4017b954", "sha256": "a97dcd711feecdde97991b01f67f67399f91eb340b996ded2ac831a539a8c411" }, "downloads": -1, "filename": "stackfull-0.20.tar.gz", "has_sig": false, "md5_digest": "b942c09ea9e2f4405d1700ac4017b954", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4242, "upload_time": "2016-11-07T18:40:47", "url": "https://files.pythonhosted.org/packages/e5/13/a3a383d4a2aabc78cfcf5d4e115446882b89393e8e17d85f08772201ab87/stackfull-0.20.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "9ffe2ff5d0040258e26820585ab4223e", "sha256": "20713213ca0ace906716dcb23d0c3cf636c867a1ecc570de1a455d783f69b952" }, "downloads": -1, "filename": "stackfull-0.8.tar.gz", "has_sig": false, "md5_digest": "9ffe2ff5d0040258e26820585ab4223e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2382, "upload_time": "2013-04-16T18:49:02", "url": "https://files.pythonhosted.org/packages/e6/6e/fcbc1c014034af20a894f96f06b4a1d0a4c8fbd080301fadcaf42d20a2da/stackfull-0.8.tar.gz" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "b687da2cf5ae1d91d19025cad49a4b93", "sha256": "a228f7180dc5c61ba07aa934443997d0ca586917a1aa16117a975a435317094a" }, "downloads": -1, "filename": "stackfull-0.9.tar.gz", "has_sig": false, "md5_digest": "b687da2cf5ae1d91d19025cad49a4b93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3257, "upload_time": "2016-03-09T04:50:54", "url": "https://files.pythonhosted.org/packages/27/1a/9975ce34787b399dec0602d79b884bfb2c21d16f3c2968727bba368f84b4/stackfull-0.9.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "c755b7600e4c0e2b9354c96cb4b16608", "sha256": "4c8f29c806c338728ddda64e723033a8dbb5179eb0c3b1262a17ada33341f3bf" }, "downloads": -1, "filename": "stackfull-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c755b7600e4c0e2b9354c96cb4b16608", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4624, "upload_time": "2018-11-29T01:28:33", "url": "https://files.pythonhosted.org/packages/c0/ae/9870880c28ea8de5c3c0b796430c33ab25cd451387860b179781659c4903/stackfull-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c755b7600e4c0e2b9354c96cb4b16608", "sha256": "4c8f29c806c338728ddda64e723033a8dbb5179eb0c3b1262a17ada33341f3bf" }, "downloads": -1, "filename": "stackfull-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c755b7600e4c0e2b9354c96cb4b16608", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4624, "upload_time": "2018-11-29T01:28:33", "url": "https://files.pythonhosted.org/packages/c0/ae/9870880c28ea8de5c3c0b796430c33ab25cd451387860b179781659c4903/stackfull-1.0.0.tar.gz" } ] }