{ "info": { "author": "James C. Stroud", "author_email": "xtald00d@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "===============\n xpermutations \n===============\n\n\nIntroduction\n------------\n\nThis package is made from the `xpermutations recipe`_\nsubmitted to ActiveState by Ulrich Hoffman.\n\nThe documentation provided therein follows and is assumed\nto be under the Creative Commons Attribution 3.0 license.\n\nInstall with pip or easy_install::\n\n sudo pip install xpermutations\n\n\nRecipe Documentation (Ulrich Hoffman)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nPermutations and combinations are often required in algorithms\nthat do a complete search of the solution space. They are\ntypically rather large so it's best not to compute them\nentirely but better to lazily generate them. This recipe\nuses Python 2.2 generators to create appropriate generator\nobjects, that can be use for example as ranges in for loops.\n\nThis recipe provides both combinations and permutations and lazily\ngenerates them. You can do arbitrary calculations on the\npermutation/combination items not just print them.\n\nIf you require the complete list of permutations, just use the\nbuilt-in list() operator. Note that the resulting list can be huge.\n\nAll x-generators defined here yield sequences with elements from the\noriginal sequence. Their difference is in which elements they take:\n\n*xpermutations()* takes all elements from the sequence, order matters.\n\n*xcombinations()* takes n distinct elements from the sequence,\norder matters.\n\n*xuniqueCombinations()* takes n distinct elements from the sequence,\norder is irrelevant.\n\n*xselections()* takes n elements (not necessarily distinct) from the\nsequence, order matters.\n\nNote that 'distinct' means \"different elements in the orginal\nsequence\" and not \"different value\", i.e.::\n\n >>> list(xuniqueCombinations('aabb', 2))\n [['a', 'a'], ['a', 'b'], ['a', 'b'], ['a', 'b'], ['a', 'b'], ['b', 'b']]\n\nCompare the latter to::\n\n >>> all_different = list(set('aabb'))\n >>> list(xuniqueCombinations(all_different, 2))\n [['a', 'b']]\n\nIf your sequence has only items with unique values, you won't\nnotice the difference (no pun intended).\n\nCaveats\n~~~~~~~\n\nSet theoreticians may take issue with the nomenclature.\n\n\nHome Page & Repository\n----------------------\n\nHome Page: https://pypi.python.org/pypi/xpermutations/\n\nRepository: https://github.com/jcstroud/xpermutations/\n\n\nExamples\n--------\n\nxcombinations()\n~~~~~~~~~~~~~~~\n\n >>> \" \".join(\"\".join(x) for x in xcombinations(\"1234\", 2))\n '12 13 14 21 23 24 31 32 34 41 42 43'\n\nxuniqueCombinations()\n~~~~~~~~~~~~~~~~~~~~~\n\n >>> \" \".join(\"\".join(x) for x in xuniqueCombinations(\"1234\", 2))\n '12 13 14 23 24 34'\n\nxselections()\n~~~~~~~~~~~~~\n\n >>> \" \".join(\"\".join(x) for x in xselections(\"1234\", 2))\n '11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44'\n\nxpermutations()\n~~~~~~~~~~~~~~~\n\n >>> \" \".join(\"\".join(x) for x in xpermutations(\"123\"))\n '123 132 213 231 312 321'\n\n\n.. _`xpermutations recipe`: http://code.activestate.com/recipes/190465-generator-for-permutations-combinations-selections/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/xpermutations/", "keywords": null, "license": "BSD (Core code is Creative Commons Attribution 3.0)", "maintainer": null, "maintainer_email": null, "name": "xpermutations", "package_url": "https://pypi.org/project/xpermutations/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/xpermutations/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/xpermutations/" }, "release_url": "https://pypi.org/project/xpermutations/1.0.1/", "requires_dist": null, "requires_python": null, "summary": "Makes permuations; Based on ActiveState recipe 190465", "version": "1.0.1" }, "last_serial": 1061601, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "80f0669d133fb07fc8be6060303c80fb", "sha256": "633420bd473740ec775df65999412395fd248948878bca9fd13af6e81c8ece8e" }, "downloads": -1, "filename": "xpermutations-1.0.0.tar.gz", "has_sig": false, "md5_digest": "80f0669d133fb07fc8be6060303c80fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4792, "upload_time": "2014-04-15T20:45:47", "url": "https://files.pythonhosted.org/packages/59/dc/25fc8b424a395dca7a286c652cc313ce47097f89c9fa2982a64b83c760d8/xpermutations-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "7e2d1f39e3450752a7162513212cca83", "sha256": "2af69729f6c3ce4673ab08f7feb1207419ed0cd13a76e44a874da5fb1ad4a8bb" }, "downloads": -1, "filename": "xpermutations-1.0.1.tar.gz", "has_sig": false, "md5_digest": "7e2d1f39e3450752a7162513212cca83", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4835, "upload_time": "2014-04-15T21:00:14", "url": "https://files.pythonhosted.org/packages/41/6f/bf11c6ec5e5d2126bd24474dc2eddbfd1f4cc738321017f4a6a4d045a5cc/xpermutations-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7e2d1f39e3450752a7162513212cca83", "sha256": "2af69729f6c3ce4673ab08f7feb1207419ed0cd13a76e44a874da5fb1ad4a8bb" }, "downloads": -1, "filename": "xpermutations-1.0.1.tar.gz", "has_sig": false, "md5_digest": "7e2d1f39e3450752a7162513212cca83", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4835, "upload_time": "2014-04-15T21:00:14", "url": "https://files.pythonhosted.org/packages/41/6f/bf11c6ec5e5d2126bd24474dc2eddbfd1f4cc738321017f4a6a4d045a5cc/xpermutations-1.0.1.tar.gz" } ] }