Popular recipes by Florian Leitner http://code.activestate.com/recipes/users/4049249/2007-10-19T08:53:32-07:00ActiveState Code RecipesList wrapper for generators (indexable, subscriptable) (Python) 2007-10-19T08:53:32-07:00Florian Leitnerhttp://code.activestate.com/recipes/users/4049249/http://code.activestate.com/recipes/534114-list-wrapper-for-generators-indexable-subscriptabl/ <p style="color: grey"> Python recipe 534114 by <a href="/recipes/users/4049249/">Florian Leitner</a> (<a href="/recipes/tags/extending/">extending</a>). Revision 4. </p> <p>Similar to &lt;a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/523026"&gt;Andrew Moffat's recipe&lt;/a&gt;, this class takes a generator function as an argument and returns a list object where the generator's items can be accessed by indices (as indices or slices). Only once a certain index value was requested, it actually iterates the generator to that point. See docstrings for more. The values are stored in a Berkeley DB which is created in a temporary file on the fly (it would not need much to modify the code to store in memory if you would prefer that) in such a manner that for any object where id(obj1) == id(obj2) is True, only one entry is stored.</p> typeparser (Python) 2007-04-15T04:24:53-07:00Florian Leitnerhttp://code.activestate.com/recipes/users/4049249/http://code.activestate.com/recipes/511473-typeparser/ <p style="color: grey"> Python recipe 511473 by <a href="/recipes/users/4049249/">Florian Leitner</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 2. </p> <p>Python type-string parser. The code evolved from a post in python-list on 11/22/05 by Fredrik Lundh on a dictionary parser. It parses a type-string to their type objects for all basic types. Raises SyntaxError and SemanticError on failures.</p> <p>Supported types: * containers: defaultdict, deque, dict, list, tuple, set * basic types: Decimal, bool, float, int, long, str * None type</p> <p>REQUIRES PYTHON &gt;= 2.5</p>