{ "info": { "author": "David J Gordon", "author_email": "djyale@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Utilities" ], "description": "Classless\n=============\n\nGet all the benefits of making your functions methods on a class\nwithout actually having define them methods on a class! \n\n**Classless** allows you, instead,\nto pass a list of functions to ```gen_class```\nand curry them on the specified attributes.\n\nExample:\n\n.. code-block:: python\n\n from classless import gen_class\n \n def fun_stuff(db, name, x):\n q = db.get(name)\n return int(q) + x\n \n def cool_stuff(q, z, name, y, db):\n db.insert(name, (q, z, y))\n \n def awesome_adventure(w, name):\n if w > 5:\n return name\n else:\n raise Exception(\"I don't approve of the name {}\".format(name))\n \n \n MyPretendClass = gen_class(methods=(fun_stuff,\n cool_stuff,\n \t\t\t\t awesome_adventure),\n \t\t init_attrs=['db', 'name'])\n\nand then we use ``MyPretendClass`` just like any regular class:\n\n.. code-block:: python\n\n obj = MyPretendClass(name='NiceName', db=some_connection)\n obj.awesome_adventure(25) # Calls awesome_adventure with name='NiceName'\n # and w=25\n \n obj.cool_stuff(1,2,3) # == cool_stuff(1, 2, 'NiceName', 3, some_connection)\n \n \n obj.fun_stuff('Dr. X') # == fun_stuff(x='Dr. X', name='NiceName',\n # db=some_connection)\nwhere ``obj`` just holds the list of ``methods`` curried on the ``init_attrs``.\n\nWe could have defined ``MyRealClass`` as so and get identical behaviour:\n\n.. code-block:: python\n\n class MyRealClass(object):\n def __init__(self, db, name):\n self.db = db\n \tself.name = name\n \n def fun_stuff(x):\n q = self.db.get(self.name)\n return int(q) + x\n \n def cool_stuff(q, z, y):\n self.db.insert(self.name, (q, z, y))\n \n def awesome_adventure(w):\n if w > 5:\n return self.name\n else:\n raise Exception(\"I don't approve of the name {}\".format(self.name))\n\nBut, then every one of those methods is tied down to a given class, and can't be used as regular functions, without first constructing ``MyRealClass``.", "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/djyale/classless", "keywords": "class meta", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "Classless", "package_url": "https://pypi.org/project/Classless/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Classless/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/djyale/classless" }, "release_url": "https://pypi.org/project/Classless/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "Easily curry multiple functions to a given list of arguments without using classes", "version": "0.0.2" }, "last_serial": 874683, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "136964bd98da99d7172d2bb4e39ae438", "sha256": "d229da96336270c803ae023414e5198597a3b1e12af6e89b50996081d8273585" }, "downloads": -1, "filename": "Classless-0.0.1.tar.gz", "has_sig": false, "md5_digest": "136964bd98da99d7172d2bb4e39ae438", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3015, "upload_time": "2013-09-03T23:22:24", "url": "https://files.pythonhosted.org/packages/fc/c4/0c76b24feebd0c993cc236f74e4d16d62db48aabb9dd2c12717c8a896236/Classless-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "d604f2708358028b3c2668541e27543f", "sha256": "0228a3b73e406300f9e22d81deaa49a5530c6a5e68a813add093733e2d2dbea4" }, "downloads": -1, "filename": "Classless-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d604f2708358028b3c2668541e27543f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3239, "upload_time": "2013-09-26T14:21:22", "url": "https://files.pythonhosted.org/packages/8c/0a/bf3d1e910f58f7517714cdaa4378c235f3684b4fa99da602d1892f8eb726/Classless-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d604f2708358028b3c2668541e27543f", "sha256": "0228a3b73e406300f9e22d81deaa49a5530c6a5e68a813add093733e2d2dbea4" }, "downloads": -1, "filename": "Classless-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d604f2708358028b3c2668541e27543f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3239, "upload_time": "2013-09-26T14:21:22", "url": "https://files.pythonhosted.org/packages/8c/0a/bf3d1e910f58f7517714cdaa4378c235f3684b4fa99da602d1892f8eb726/Classless-0.0.2.tar.gz" } ] }