{ "info": { "author": "Phillip J. Eby", "author_email": "peak@eby-sarna.com", "bugtrack_url": null, "classifiers": [], "description": "===========================================\r\nCreating Generic Functions using PEAK-Rules\r\n===========================================\r\n\r\nPEAK-Rules is a highly-extensible framework for creating and using generic\r\nfunctions, from the very simple to the very complex. Out of the box, it\r\nsupports multiple-dispatch on positional arguments using tuples of types,\r\nfull predicate dispatch using strings containing Python expressions, and\r\nCLOS-like method combining. (But the framework allows you to mix and match\r\ndispatch engines and custom method combinations, if you need or want to.)\r\n\r\nBasic usage::\r\n\r\n >>> from peak.rules import abstract, when, around, before, after\r\n\r\n >>> @abstract()\r\n ... def pprint(ob):\r\n ... \"\"\"A pretty-printing generic function\"\"\"\r\n\r\n >>> @when(pprint, (list,))\r\n ... def pprint_list(ob):\r\n ... print \"pretty-printing a list\"\r\n\r\n >>> @when(pprint, \"isinstance(ob,list) and len(ob)>50\")\r\n ... def pprint_long_list(ob):\r\n ... print \"pretty-printing a long list\"\r\n\r\n >>> pprint([1,2,3])\r\n pretty-printing a list\r\n\r\n >>> pprint([42]*1000)\r\n pretty-printing a long list\r\n\r\n >>> pprint(42)\r\n Traceback (most recent call last):\r\n ...\r\n NoApplicableMethods: ...\r\n\r\nPEAK-Rules works with Python 2.3 and up -- just omit the ``@`` signs if your\r\ncode needs to run under 2.3. Also, note that with PEAK-Rules, *any* function\r\ncan be generic: you don't have to predeclare a function as generic. (The\r\n``abstract`` decorator is used to declare a function with no *default* method;\r\ni.e., one that will give a ``NoApplicableMethods`` if no rules match the\r\narguments it's invoked with, as opposed to executing a default implementation.)\r\n\r\nPEAK-Rules is still under development; it lacks much in the way of error\r\nchecking, so if you mess up your rules, it may not be obvious where or how you\r\ndid. User documentation is also lacking, although there are extensive doctests\r\ndescribing and testing most of its internals, including:\r\n\r\n* `Introduction`_ (Method combination, porting from RuleDispatch)\r\n* `Core Design Overview`_ (Terminology, method precedence, etc.)\r\n* The `Basic AST Builder`_ and advanced `Code Generation`_\r\n* `Criteria`_, `Indexing`_, and `Predicates`_\r\n* `Syntax pattern matching`_\r\n\r\n(Please note that these documents are still in a state of flux and some may\r\nstill be incomplete or disorganized, prior to the first official release.)\r\n\r\nSource distribution snapshots are generated daily, but you can also update\r\ndirectly from the `development version`_ in SVN.\r\n\r\n.. _development version: svn://svn.eby-sarna.com/svnroot/PEAK-Rules#egg=PEAK_Rules-dev\r\n.. _Introduction: http://peak.telecommunity.com/DevCenter/PEAK-Rules#toc\r\n.. _Core Design Overview: http://peak.telecommunity.com/DevCenter/PEAK-Rules/Design\r\n.. _Predicates: http://peak.telecommunity.com/DevCenter/PEAK-Rules/Predicates\r\n.. _Basic AST Builder: http://peak.telecommunity.com/DevCenter/PEAK-Rules/AST-Builder\r\n.. _Code Generation: http://peak.telecommunity.com/DevCenter/PEAK-Rules/Code-Generation\r\n.. _Criteria: http://peak.telecommunity.com/DevCenter/PEAK-Rules/Criteria\r\n.. _Indexing: http://peak.telecommunity.com/DevCenter/PEAK-Rules/Indexing\r\n.. _Predicates: http://peak.telecommunity.com/DevCenter/PEAK-Rules/Predicates\r\n.. _Syntax pattern matching: http://peak.telecommunity.com/DevCenter/PEAK-Rules/Syntax-Matching\r\n\r\n.. _toc:", "description_content_type": null, "docs_url": null, "download_url": "http://peak.telecommunity.com/snapshots/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/PEAK-Rules", "keywords": "", "license": "ZPL 2.1", "maintainer": "", "maintainer_email": "", "name": "PEAK-Rules", "package_url": "https://pypi.org/project/PEAK-Rules/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/PEAK-Rules/", "project_urls": { "Download": "http://peak.telecommunity.com/snapshots/", "Homepage": "http://pypi.python.org/pypi/PEAK-Rules" }, "release_url": "https://pypi.org/project/PEAK-Rules/0.5a1.dev/", "requires_dist": null, "requires_python": null, "summary": "Generic functions and business rules support systems", "version": "0.5a1.dev" }, "last_serial": 196022, "releases": { "0.5a1.dev": [] }, "urls": [] }