Popular recipes by Jacob Oscarson http://code.activestate.com/recipes/users/1355144/2010-01-24T04:19:12-08:00ActiveState Code RecipesTemporary substitution of object in modules via with statement (Python) 2010-01-24T04:19:12-08:00Jacob Oscarsonhttp://code.activestate.com/recipes/users/1355144/http://code.activestate.com/recipes/577020-temporary-substitution-of-object-in-modules-via-wi/ <p style="color: grey"> Python recipe 577020 by <a href="/recipes/users/1355144/">Jacob Oscarson</a> (<a href="/recipes/tags/modules/">modules</a>, <a href="/recipes/tags/testing/">testing</a>, <a href="/recipes/tags/with_statement/">with_statement</a>). </p> <p>See docstring in the code</p> Dict-like string formatting from an object by named atttributes (Python) 2009-08-17T12:59:16-07:00Jacob Oscarsonhttp://code.activestate.com/recipes/users/1355144/http://code.activestate.com/recipes/576883-dict-like-string-formatting-from-an-object-by-name/ <p style="color: grey"> Python recipe 576883 by <a href="/recipes/users/1355144/">Jacob Oscarson</a> (<a href="/recipes/tags/regex/">regex</a>, <a href="/recipes/tags/text/">text</a>). </p> <p>Formats a string using the same notation as a dict-expansion, but using an object as the source for the expansion instead. Attributes from the object are used as source to the expansions.</p> String representation of a dict (sorted by key) (Python) 2008-06-16T13:37:45-07:00Jacob Oscarsonhttp://code.activestate.com/recipes/users/1355144/http://code.activestate.com/recipes/573453-string-representation-of-a-dict-sorted-by-key/ <p style="color: grey"> Python recipe 573453 by <a href="/recipes/users/1355144/">Jacob Oscarson</a> . </p> <p>I quite often find a need to create a 'key-value' pair representation of a dictionary as a string, mainly using generators and the .join method of string objects</p>