Most viewed recipes by Danny Yoo http://code.activestate.com/recipes/users/98032/views/2006-11-12T03:23:54-08:00ActiveState Code Recipesgetch()-like unbuffered character reading from stdin on both Windows and Unix (Python) 2003-01-07T02:31:32-08:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/134892-getch-like-unbuffered-character-reading-from-stdin/ <p style="color: grey"> Python recipe 134892 by <a href="/recipes/users/98032/">Danny Yoo</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). Revision 2. </p> <p>A small utility class to read single characters from standard input, on both Windows and UNIX systems. It provides a getch() function-like instance.</p> Grabbing the current line number easily (Python) 2002-08-16T16:55:41-07:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/145297-grabbing-the-current-line-number-easily/ <p style="color: grey"> Python recipe 145297 by <a href="/recipes/users/98032/">Danny Yoo</a> . </p> <p>This snippet of code allows us to grab the current line number easily, and demonstrates the power of the 'inspect' module for introspective Python programs.</p> Quick and easy FIFO queue class (Python) 2003-07-15T23:28:25-07:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/210459-quick-and-easy-fifo-queue-class/ <p style="color: grey"> Python recipe 210459 by <a href="/recipes/users/98032/">Danny Yoo</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 2. </p> <p>An easy First-In-First-Out queue class based on Python's List data structure.</p> Avoiding lambda in writing callback functions (Python) 2001-08-16T12:41:55-07:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/66521-avoiding-lambda-in-writing-callback-functions/ <p style="color: grey"> Python recipe 66521 by <a href="/recipes/users/98032/">Danny Yoo</a> . </p> <p>A utility class that makes writing callbacks more pleasant than using lambda. Especially using with Tkinter.</p> Merging two sorted iterators into a single iterator (Python) 2003-04-30T23:04:43-07:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/197530-merging-two-sorted-iterators-into-a-single-iterato/ <p style="color: grey"> Python recipe 197530 by <a href="/recipes/users/98032/">Danny Yoo</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 2. </p> <p>Provides a mergeiter() function that can merge two iterators into a single iterator. Uses generators, and guarantees constant memory use.</p> Permutations using generators (Python) 2002-01-05T12:59:47-08:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/105962-permutations-using-generators/ <p style="color: grey"> Python recipe 105962 by <a href="/recipes/users/98032/">Danny Yoo</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). </p> <p>permIter() takes a sequence and returns an iterator that goes through all possible permutations of that sequence.</p> Deeply applying str() across a data structure (Python) 2006-11-12T03:23:54-08:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/498261-deeply-applying-str-across-a-data-structure/ <p style="color: grey"> Python recipe 498261 by <a href="/recipes/users/98032/">Danny Yoo</a> (<a href="/recipes/tags/text/">text</a>). Revision 3. </p> <p>The str() in the standard library behaves in a slightly weird way when applied against lists: on each element of the list, the repr() is appended. In contrast, this module provides a deep_str() that deeply applies str() across lists.</p> How to take the "cross product" of two infinite sequences (Python) 2001-03-16T01:48:55-08:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/52271-how-to-take-the-cross-product-of-two-infinite-sequ/ <p style="color: grey"> Python recipe 52271 by <a href="/recipes/users/98032/">Danny Yoo</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). </p> <p>This piece of code takes in two infinite sequences, and, with the help of a cute math function, can cross these two together into another infinite sequence. (This is related to the diagonalization proof that the rationals are countable.) It should guarantee that, given enough time, we can reach any particular element.</p> Enable xmlrpclib to maintain a JSP session (Python) 2002-11-10T08:46:45-08:00Danny Yoohttp://code.activestate.com/recipes/users/98032/http://code.activestate.com/recipes/161816-enable-xmlrpclib-to-maintain-a-jsp-session/ <p style="color: grey"> Python recipe 161816 by <a href="/recipes/users/98032/">Danny Yoo</a> . </p> <p>This extension to xmlrpclib allows us to maintain a session with a JSP server, so that there appears to be a stateful session. It tries to maintain the JSESSIONID call between calls to the server.</p>