{ "info": { "author": "F. G. Rejon Barrera", "author_email": "f.g.rejonbarrera@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "PyTlin\n======\n\nModule implementing the Kotlin functions ``also``, ``let``, and ``run``\nin Python. Additionally it includes sh-like (and Mathematica-like)\npiping syntax.\n\nThe Kotlin functions are documented in\n`here `__.\n\nInstall\n=======\n\n.. code:: python\n\n pip install PyTlin\n\nSyntax\n======\n\n.. code:: python\n\n from PyTlin import k\n\n k(obj).let(func).also(func)\n k.run(func)\n k(obj) | func1 | func2 | ...\n k(obj) @ func1 @ func2 @ ...\n\nHere all expressions (except ``k.run(func)``) is wrapped in the class\n``k``. To recover ``obj`` one can apply either of these\n\n.. code:: python\n\n k(obj).end\n k(obj) | 'end'\n k(obj) | 0\n k(obj) @ 'end'\n k(obj) @ 0\n\nExample\n=======\n\n.. code:: python\n\n from PyTlin import k\n class Person:\n def __init__(self,name,age):\n self.name = name\n self.age = age\n def __repr__(self):\n return '%s, %d' % (self.name, self.age)\n def increaseAge(self):\n self.age = self.age + 1\n def nameToUpperCase(self):\n self.name = self.name.upper()\n\n student = Person('Pete', 18)\n print(student) #Pete, 18\n\nlet\n---\n\n.. code:: python\n\n name = k(student).let(lambda x: (print(x),x.name)[1]) #Pete, 18\n print(name) #Pete\n\nalso\n----\n\n.. code:: python\n\n newstudent = k(student).also(lambda x: (x.increaseAge(), x.nameToUpperCase()))\n print(newstudent) #PETE, 19\n\nrun\n---\n\n.. code:: python\n\n mood = 'sad'\n k.run(lambda mood = 'happy': print(mood)) #happy\n print(mood) #sad\n\nPiping\n------\n\nPiping can be done with either ``.let`` or with pipe operators ``@``\n(Mathematica-like in reverse order) or ``|`` (sh-like).\n\n.. code:: python\n\n ops=k(4).let(lambda x: x*2).let(lambda x: x+3)\n print(ops) #11\n print(type(ops)) #\n print(ops.end) #11\n print(type(ops.end)) #\n\n print(ops.end ==\n k(4) @ (lambda x: x*2) @ (lambda x: x+3) @ 'end') #True\n\n print(ops.end ==\n k(4) | (lambda x: x*2) | (lambda x: x+3) | 0) #True\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/frejonb/PyTlin", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "PyTlin", "package_url": "https://pypi.org/project/PyTlin/", "platform": "", "project_url": "https://pypi.org/project/PyTlin/", "project_urls": { "Homepage": "https://github.com/frejonb/PyTlin" }, "release_url": "https://pypi.org/project/PyTlin/1.2/", "requires_dist": null, "requires_python": "", "summary": "Kotlin functions also, let, and run, as well as sh-like (and Mathematica-like) piping syntax", "version": "1.2" }, "last_serial": 3948046, "releases": { "1.2": [ { "comment_text": "", "digests": { "md5": "e1c965f191e1b9b728f9f9de66985ebf", "sha256": "a85502cb32f9f594d59376a4f7912a9e6a0576c4f7632ec55b38b46d4acb253b" }, "downloads": -1, "filename": "PyTlin-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e1c965f191e1b9b728f9f9de66985ebf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3862, "upload_time": "2018-06-10T19:26:26", "url": "https://files.pythonhosted.org/packages/48/16/7c7ce59bcc3b2d4689b96eed0ecad8a493c78c34aa2ff376d3b0a7b9d0c4/PyTlin-1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "346e4d225359ce2dac4aa081acb042e8", "sha256": "9cfd11488708c55db4d97ff2d7c802867e34f4e37a42faa2ba1a8b62355c6140" }, "downloads": -1, "filename": "PyTlin-1.2.tar.gz", "has_sig": false, "md5_digest": "346e4d225359ce2dac4aa081acb042e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1992, "upload_time": "2018-06-10T19:26:27", "url": "https://files.pythonhosted.org/packages/fa/c2/0c6cfa86895c8cbf558b2942c8cd6e6f748eb6e0a0627e5c1fdbe17cae36/PyTlin-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e1c965f191e1b9b728f9f9de66985ebf", "sha256": "a85502cb32f9f594d59376a4f7912a9e6a0576c4f7632ec55b38b46d4acb253b" }, "downloads": -1, "filename": "PyTlin-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e1c965f191e1b9b728f9f9de66985ebf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3862, "upload_time": "2018-06-10T19:26:26", "url": "https://files.pythonhosted.org/packages/48/16/7c7ce59bcc3b2d4689b96eed0ecad8a493c78c34aa2ff376d3b0a7b9d0c4/PyTlin-1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "346e4d225359ce2dac4aa081acb042e8", "sha256": "9cfd11488708c55db4d97ff2d7c802867e34f4e37a42faa2ba1a8b62355c6140" }, "downloads": -1, "filename": "PyTlin-1.2.tar.gz", "has_sig": false, "md5_digest": "346e4d225359ce2dac4aa081acb042e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1992, "upload_time": "2018-06-10T19:26:27", "url": "https://files.pythonhosted.org/packages/fa/c2/0c6cfa86895c8cbf558b2942c8cd6e6f748eb6e0a0627e5c1fdbe17cae36/PyTlin-1.2.tar.gz" } ] }