{ "info": { "author": "Kirk Strauser", "author_email": "kirk@strauser.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Topic :: Software Development :: Libraries" ], "description": "# Haven't you always wanted an infinite dict?\r\n\r\nIterDicts are similar to regular Python dicts except that they're only\r\npopulated upon demand. This gives them most of the same advantages of\r\ngenerators, such as the ability to operator on very large (or infinite!)\r\ndatasets.\r\n\r\n## Accessing keys that aren't populated yet\r\n\r\nWhen the `get` or `__getitem__` methods are called, an IterDict tries to\r\nfetch a key in the normal manner. If that fails, it starts consuming the\r\niterator it was constructed with and adding those items to itself until\r\nit finds the key (or the universe dies of heat death):\r\n\r\n >>> d = IterDict((a, a) for a in xrange(1000000000000000)) # 1 quadrillion (US)\r\n >>> d[10]\r\n 10\r\n >>> list(d)\r\n [you're going to be here a while]\r\n\r\n## Important differences\r\n\r\nA dict consumes its iterator at initialization, and in the case of duplicates\r\nthe last value wins:\r\n\r\n >>> d = dict([(1,1),(1,2)])\r\n >>> d\r\n {1: 2}\r\n >>> del d[1]\r\n >>> d\r\n {}\r\n\r\nIterDicts differ in that they stop consuming their iterators as soon as the\r\nfirst instance of a requested key is found:\r\n\r\n >>> i = IterDict([(1,1), (1,2)])\r\n >>> i\r\n IterDict<{}, fed by >\r\n >>> i[1]\r\n 1\r\n >>> i\r\n IterDict<{1: 1}, fed by >\r\n\r\nFor space, time, and complexity reasons, IterDicts don't track keys that were\r\npresent at one point and have been since deleted. This means that keys may\r\nreappear after deletion if the IterDict's iterator yields them again.\r\nContinuing the previous example:\r\n\r\n >>> del i[1]\r\n >>> i\r\n IterDict<{}, fed by >\r\n >>> i[1]\r\n 2\r\n >>> i\r\n IterDict<{1: 2}, fed by >", "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/kstrauser/iterdict", "keywords": "dict lazy bigdata", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "IterDict", "package_url": "https://pypi.org/project/IterDict/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/IterDict/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/kstrauser/iterdict" }, "release_url": "https://pypi.org/project/IterDict/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Dict that lazily populates itself with items from the iterator it was constructed with as keys are accessed", "version": "0.2.0" }, "last_serial": 762621, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "073d9c6f6bc147923af8439bdb1fd617", "sha256": "998a206747b44bf55dd9e53928f98fb57aef6ff0d906c50af5dd3e69e072b3fc" }, "downloads": -1, "filename": "IterDict-0.1.0.tar.gz", "has_sig": false, "md5_digest": "073d9c6f6bc147923af8439bdb1fd617", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5323, "upload_time": "2012-05-12T20:52:10", "url": "https://files.pythonhosted.org/packages/9c/9e/01c4ba5c54fa35c024361c205704cfbec35b3a58c72d23a0be8706bf3f49/IterDict-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "58197ecf15d52c8df58d818b5ed1bb49", "sha256": "5c2630e562bf0627551bddd7569e491b92ea6b4512353eb7442cd1c7ca1d0469" }, "downloads": -1, "filename": "IterDict-0.2.0.tar.gz", "has_sig": false, "md5_digest": "58197ecf15d52c8df58d818b5ed1bb49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5657, "upload_time": "2012-05-14T01:27:27", "url": "https://files.pythonhosted.org/packages/23/0e/eb68c8094cf2a24067bf771b7851246b106deb599e034f192c74c834ebc5/IterDict-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "58197ecf15d52c8df58d818b5ed1bb49", "sha256": "5c2630e562bf0627551bddd7569e491b92ea6b4512353eb7442cd1c7ca1d0469" }, "downloads": -1, "filename": "IterDict-0.2.0.tar.gz", "has_sig": false, "md5_digest": "58197ecf15d52c8df58d818b5ed1bb49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5657, "upload_time": "2012-05-14T01:27:27", "url": "https://files.pythonhosted.org/packages/23/0e/eb68c8094cf2a24067bf771b7851246b106deb599e034f192c74c834ebc5/IterDict-0.2.0.tar.gz" } ] }