{ "info": { "author": "valtron", "author_email": "valtron2000+pyta@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "======================================\nPyta: Inner Method Dispatch for Python\n======================================\n\nPyta = Python + Beta\n\nInspired by: http://www.cs.utah.edu/plt/publications/oopsla04-gff.pdf\n\n\nUsage\n=====\n\nInner dispatch is used to guarantee pre- and post-conditions without\nusing auxiliary methods. An external dispatch results in the lowest method\nthat calls ``inner`` being called. An ``inner(cls, self)`` call calls the\nnext highest method that has an ``inner`` call, or the highest method if\nthere is no higher ``inner`` method. ``super`` works the same as before,\nbut take care not to cause an infinite loop.\n\nFull example::\n\n from pyta import inner, BetaMetaclass\n \n class A(object):\n def foo(self):\n print \"world!\"\n \n class B(A): # Can inherit from regular classes\n # The lowest class in the hierarchy that uses `inner` needs the metaclass\n __metaclass__ = BetaMetaclass\n \n def foo(self):\n inner(B, self).foo() # Calls C.foo\n super(B, self).foo() # Calls A.foo\n \n class C(B):\n def foo(self):\n print \"Hello, \"\n \n obj = C()\n obj.foo() # External dispatch; calls B.foo\n\nCaveats\n=======\n\nBecause using ``inner`` in a superclass completely changes which method\nan external dispatch resolves to (it's no longer the most-overriding method)\nthe metaclass is required to inspect the source of the methods and sprinkle\nsome magic to make it all work.\n\nIn order for everything to work properly, you *must* call ``inner(cls, self)``\n*lexically*. In other words, it won't work if you do this::\n\n bar = inner\n bar(cls, self).foo()\n\nOr this::\n\n from pyta import inner as bar\n bar(cls, self).foo()\n\nCurrently, the implementation doesn't distinguish between strings vs. actual method\ncalls, so if your method contains a string like ``\"text inner( moretext\"``, it'll\nbreak everything.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/valtron/pyta", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "pyta", "package_url": "https://pypi.org/project/pyta/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyta/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/valtron/pyta" }, "release_url": "https://pypi.org/project/pyta/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Inner Method Dispatch for Python", "version": "0.1.1" }, "last_serial": 724473, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "070e55c7b1b4df32607b698f04f3509d", "sha256": "44854222ad63aaac12256fb337a68aba1af2bc334b47163d34ad4af562838097" }, "downloads": -1, "filename": "pyta-0.1.0.tar.gz", "has_sig": false, "md5_digest": "070e55c7b1b4df32607b698f04f3509d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16430, "upload_time": "2013-03-12T17:48:04", "url": "https://files.pythonhosted.org/packages/83/60/37b3d11e250253c46d412b825db7fe85dbc878c34535863958273c35ff93/pyta-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "9e23e5210881c0a48ebb75404a9783fd", "sha256": "cf9d22b2ae1d5593e661f1ca106b7716127de07b12e2411ed8a6f953a1d36716" }, "downloads": -1, "filename": "pyta-0.1.1.zip", "has_sig": false, "md5_digest": "9e23e5210881c0a48ebb75404a9783fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4699, "upload_time": "2013-03-24T00:47:29", "url": "https://files.pythonhosted.org/packages/c6/0a/3344369bb8f96f13a3448896f70cdf8705b4b75f21c6201b89d3a0feb122/pyta-0.1.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9e23e5210881c0a48ebb75404a9783fd", "sha256": "cf9d22b2ae1d5593e661f1ca106b7716127de07b12e2411ed8a6f953a1d36716" }, "downloads": -1, "filename": "pyta-0.1.1.zip", "has_sig": false, "md5_digest": "9e23e5210881c0a48ebb75404a9783fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4699, "upload_time": "2013-03-24T00:47:29", "url": "https://files.pythonhosted.org/packages/c6/0a/3344369bb8f96f13a3448896f70cdf8705b4b75f21c6201b89d3a0feb122/pyta-0.1.1.zip" } ] }