{ "info": { "author": "Sean True", "author_email": "strue@smartvid.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Build Tools" ], "description": "fstring427\n==========\n\nPython 3.6 f-string sympathy (partial compatibility) module for Python\n2.7 See https://www.python.org/dev/peps/pep-0498/ for the specification\nfor *Literal String Interpolation*.\n\nExample from PEP-0498\n---------------------\n\n::\n\n >>> import datetime\n >>> name = 'Fred'\n >>> age = 50\n >>> anniversary = datetime.date(1991, 10, 12)\n >>> f'My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.'\n 'My name is Fred, my age next year is 51, my anniversary is Saturday, October 12, 1991.'\n >>> f'He said his name is {name!r}.'\n \"He said his name is 'Fred'.\"\n\nSympathetic output from fstring427\n----------------------------------\n\n::\n\n >>> from fstring427.fstring import Fmt as f\n >>> import datetime\n >>> name = 'Fred'\n >>> age = 50\n >>> anniversary = datetime.date(1991,10,12)\n >>> str(f('My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.'))\n 'My name is Fred, my age next year is 51, my anniversary is Saturday, October 12, 1991.'\n >>> f('He said his name is {name!r}')()\n \"He said his name is 'Fred'\"\n\nNote the major differences:\n\n- ``f`` is a class, not a string type\n- ``f()`` evaluates the string\n- str() of a instance of ``f`` also evaluates the string\n\nThe underlying implementation is a subclass of the Python 2.7 Format\nclass, and depends on internals. Obviously fragile and probably\nnon-portable, but still serves my purpose.\n\n## ``printf()``, a convenience function\n\n``>>> printf('He said his name is {name!r}') He said his name is 'Fred'``\n\nwhich has the additional convenience of a temporary scope for kwargs\n\n::\n\n >>> printf('He said his name is {name!r}', name=\"Sam\")\n He said his name is 'Sam'\n\nMajor incompatibilities\n-----------------------\n\nPython 3.6 f-strings were carefully designed, and cover edge cases that\n.format() does not, see\nhttps://mail.python.org/pipermail/python-ideas/2015-July/034726.html\n\nfstring427 was implemented on top of .format() and shares the underlying\nimplementation of lookups. If .format() can't handle a ``{field}``,\nfstring427 will evaluate field as a Python expression in the proper\nscope. In practice this means that:\n\n::\n\n a = 10\n d = {'a': 'string', 10: 'int'}\n printf(\"{d[a]\")\n\nprints ``string`` (Python 2.7 .format() behavior) instead of ``int``\n(Python 3.6 f-string behavior). I've found this a small price to pay in\nmy 2.7 code to get cleaner printing and string formatting.\n\nRoadmap\n-------\n\n- Add ``printf()`` style logging module\n- Contemplate 2-3 port for printf() utility function (dealing with the\n kwargs scope)\n\n*Copyright 2017, Smartvid.io*\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/smartvid-io/fstring427", "keywords": "programmer productivity", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "fstring427", "package_url": "https://pypi.org/project/fstring427/", "platform": "", "project_url": "https://pypi.org/project/fstring427/", "project_urls": { "Homepage": "https://github.com/smartvid-io/fstring427" }, "release_url": "https://pypi.org/project/fstring427/0.9.9/", "requires_dist": null, "requires_python": "", "summary": "Python 3.6 f-string sympathy for Python 2.7. Now with printf()", "version": "0.9.9" }, "last_serial": 2839278, "releases": { "0.9.9": [ { "comment_text": "", "digests": { "md5": "1d9596edfb5686e749428aed2f4fb312", "sha256": "5fd65ddfb1fffa52932c65741f0523ac781aa1086ac988cbdea45eed8b8442bd" }, "downloads": -1, "filename": "fstring427-0.9.9-py2-none-any.whl", "has_sig": false, "md5_digest": "1d9596edfb5686e749428aed2f4fb312", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6709, "upload_time": "2017-04-29T15:28:51", "url": "https://files.pythonhosted.org/packages/c4/86/dbafa4ce325e154d1f713b4336315055ec3ffd8f5ab0791d0782ef286f7c/fstring427-0.9.9-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50601c5fda79e78f4ba0f3c1d06fc89e", "sha256": "fdea61a7c43742bec01189de1e739ccd4b4982b092f5ffdc79eb0d2c281885b6" }, "downloads": -1, "filename": "fstring427-0.9.9.tar.gz", "has_sig": false, "md5_digest": "50601c5fda79e78f4ba0f3c1d06fc89e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3582, "upload_time": "2017-04-29T15:28:50", "url": "https://files.pythonhosted.org/packages/3a/f4/4a32385a4c8c3d379adfc98de81d1132094d007e412f89c31a16699e9b7e/fstring427-0.9.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1d9596edfb5686e749428aed2f4fb312", "sha256": "5fd65ddfb1fffa52932c65741f0523ac781aa1086ac988cbdea45eed8b8442bd" }, "downloads": -1, "filename": "fstring427-0.9.9-py2-none-any.whl", "has_sig": false, "md5_digest": "1d9596edfb5686e749428aed2f4fb312", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6709, "upload_time": "2017-04-29T15:28:51", "url": "https://files.pythonhosted.org/packages/c4/86/dbafa4ce325e154d1f713b4336315055ec3ffd8f5ab0791d0782ef286f7c/fstring427-0.9.9-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50601c5fda79e78f4ba0f3c1d06fc89e", "sha256": "fdea61a7c43742bec01189de1e739ccd4b4982b092f5ffdc79eb0d2c281885b6" }, "downloads": -1, "filename": "fstring427-0.9.9.tar.gz", "has_sig": false, "md5_digest": "50601c5fda79e78f4ba0f3c1d06fc89e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3582, "upload_time": "2017-04-29T15:28:50", "url": "https://files.pythonhosted.org/packages/3a/f4/4a32385a4c8c3d379adfc98de81d1132094d007e412f89c31a16699e9b7e/fstring427-0.9.9.tar.gz" } ] }