{ "info": { "author": "Wijnand Modderman", "author_email": "maze@pyth0n.org", "bugtrack_url": null, "classifiers": [], "description": "==================================\r\n Ternary operation implementation\r\n==================================\r\n\r\nThis is a simple hack using the slice operation to mimic C-style\r\nternary operation::\r\n\r\n x = a ? b : c\r\n\r\nIn Python we would write::\r\n\r\n >>> x = a and b or c\r\n\r\nOr (rather than above, this is safe for returning Falsy values for b)::\r\n\r\n >>> x = (a and [b] or [c])[0]\r\n\r\nOr::\r\n\r\n >>> x = b if a else c\r\n\r\nOr::\r\n\r\n >>> x = lambda i: (b, c)[not a]\r\n\r\nOr::\r\n\r\n >>> if a:\r\n ... x = b\r\n ... else:\r\n ... x = c\r\n\r\nNow we can also write::\r\n\r\n >>> x = ternary[a:b:c]\r\n\r\nUsage\r\n=====\r\n\r\nUsing the slice operation::\r\n\r\n >>> value = ternary[condition:true_result:false_result]", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://maze.io/", "keywords": "ternary operation", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ternary", "package_url": "https://pypi.org/project/ternary/", "platform": "", "project_url": "https://pypi.org/project/ternary/", "project_urls": { "Homepage": "http://maze.io/" }, "release_url": "https://pypi.org/project/ternary/0.1/", "requires_dist": null, "requires_python": null, "summary": "Ternary operation implementation", "version": "0.1" }, "last_serial": 738893, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "606a5c55f9eb6f833dcddca318fcfdaf", "sha256": "1eb391437c61e23ec9681f77283bed086aac9b69b4299e8a9cd7caded46121f8" }, "downloads": -1, "filename": "ternary-0.1-py2.6.egg", "has_sig": false, "md5_digest": "606a5c55f9eb6f833dcddca318fcfdaf", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 2231, "upload_time": "2010-07-22T16:46:15", "url": "https://files.pythonhosted.org/packages/e9/9c/b9d4303ac889c1a980a10bd83bcb118fbfd0980b0cd00356c54f68ed63ac/ternary-0.1-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "7bee4728ed3b7a6f7a32dfae7de0a496", "sha256": "a5ca7ef31724847b31db28fde4b224d32eec0b98bf45ccb77cb1a44f6ad02c8f" }, "downloads": -1, "filename": "ternary-0.1.tar.gz", "has_sig": false, "md5_digest": "7bee4728ed3b7a6f7a32dfae7de0a496", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1316, "upload_time": "2010-07-22T16:46:14", "url": "https://files.pythonhosted.org/packages/81/92/1c1e2febb6c54b07ac7c9ea98a5e3a1b91aa870fd2a5cb935d3ff0f0240b/ternary-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "606a5c55f9eb6f833dcddca318fcfdaf", "sha256": "1eb391437c61e23ec9681f77283bed086aac9b69b4299e8a9cd7caded46121f8" }, "downloads": -1, "filename": "ternary-0.1-py2.6.egg", "has_sig": false, "md5_digest": "606a5c55f9eb6f833dcddca318fcfdaf", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 2231, "upload_time": "2010-07-22T16:46:15", "url": "https://files.pythonhosted.org/packages/e9/9c/b9d4303ac889c1a980a10bd83bcb118fbfd0980b0cd00356c54f68ed63ac/ternary-0.1-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "7bee4728ed3b7a6f7a32dfae7de0a496", "sha256": "a5ca7ef31724847b31db28fde4b224d32eec0b98bf45ccb77cb1a44f6ad02c8f" }, "downloads": -1, "filename": "ternary-0.1.tar.gz", "has_sig": false, "md5_digest": "7bee4728ed3b7a6f7a32dfae7de0a496", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1316, "upload_time": "2010-07-22T16:46:14", "url": "https://files.pythonhosted.org/packages/81/92/1c1e2febb6c54b07ac7c9ea98a5e3a1b91aa870fd2a5cb935d3ff0f0240b/ternary-0.1.tar.gz" } ] }