Popular recipes tagged "meta:loc=300"http://code.activestate.com/recipes/tags/meta:loc=300/2016-07-14T21:08:01-07:00ActiveState Code RecipesConvert Spelled out Integers (e.g. three thousand two hundred fifty) into Integers (e.g. 3250) and Vice Versa (Python) 2016-07-14T21:08:01-07:00Chathura Gunasekarahttp://code.activestate.com/recipes/users/4194443/http://code.activestate.com/recipes/580689-convert-spelled-out-integers-eg-three-thousand-two/ <p style="color: grey"> Python recipe 580689 by <a href="/recipes/users/4194443/">Chathura Gunasekara</a> (<a href="/recipes/tags/integers/">integers</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/strings/">strings</a>). </p> <p>-Provides an isNumber function that can test if a floating point number is a number -str_to_int can convert a spelled out integer (e.g. 'one hundred thirty five') to its numeric form (e.g. 135) -int_to_str can convert an integer into its spelled out form.</p> Convert Spelled out Integers (e.g. three thousand two hundred fifty) into Integers (e.g. 3250) and Vice Versa (Python) 2016-06-09T20:35:26-07:00Brandon Martinhttp://code.activestate.com/recipes/users/4194238/http://code.activestate.com/recipes/580679-convert-spelled-out-integers-eg-three-thousand-two/ <p style="color: grey"> Python recipe 580679 by <a href="/recipes/users/4194238/">Brandon Martin</a> (<a href="/recipes/tags/integers/">integers</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/strings/">strings</a>). </p> <p>-Provides an isNumber function that can test if a floating point number is a number -str_to_int can convert a spelled out integer (e.g. 'one hundred thirty five') to its numeric form (e.g. 135) -int_to_str can convert an integer into its spelled out form.</p> asyncore scheduler (Python) 2011-07-25T23:42:21-07:00Giampaolo RodolĂ http://code.activestate.com/recipes/users/4178764/http://code.activestate.com/recipes/577808-asyncore-scheduler/ <p style="color: grey"> Python recipe 577808 by <a href="/recipes/users/4178764/">Giampaolo RodolĂ </a> (<a href="/recipes/tags/asynchronous/">asynchronous</a>, <a href="/recipes/tags/asyncore/">asyncore</a>, <a href="/recipes/tags/heapq/">heapq</a>, <a href="/recipes/tags/nonblocking/">nonblocking</a>, <a href="/recipes/tags/scheduler/">scheduler</a>, <a href="/recipes/tags/twisted/">twisted</a>). Revision 5. </p> <p>The thing I miss mostly in asyncore is a system for calling a function after a certain amount of time without blocking. This is crucial for simple tasks such as disconnecting a peer after a certain time of inactivity or more advanced use cases such as <a href="http://code.google.com/p/pyftpdlib/source/browse/tags/release-0.6.0/pyftpdlib/ftpserver.py#1048">bandwidth throttling</a>.</p> <p>This recipe was initially inspired by Twisted's internet.base.DelayedCall class:</p> <p><a href="http://twistedmatrix.com/trac/browser/tags/last_vfs_and_web2/twisted/internet/base.py#L34" rel="nofollow">http://twistedmatrix.com/trac/browser/tags/last_vfs_and_web2/twisted/internet/base.py#L34</a></p> <p>...then included into pyftpdlib:</p> <p><a href="http://code.google.com/p/pyftpdlib/issues/detail?id=72" rel="nofollow">http://code.google.com/p/pyftpdlib/issues/detail?id=72</a></p> <p>...and finally proposed for inclusion into asyncore:</p> <p><a href="http://bugs.python.org/issue1641" rel="nofollow">http://bugs.python.org/issue1641</a></p> Red black tree (Python) 2009-06-20T03:11:59-07:00John Reidhttp://code.activestate.com/recipes/users/4023487/http://code.activestate.com/recipes/576817-red-black-tree/ <p style="color: grey"> Python recipe 576817 by <a href="/recipes/users/4023487/">John Reid</a> (<a href="/recipes/tags/red_black/">red_black</a>, <a href="/recipes/tags/tree/">tree</a>). </p> <p>A straightforward red-black tree implementation based on the algorithms in the "Introduction to Algorithms" book by Cormen, Leiserson, Rivest, Stein. Unfortunately I have not needed delete functionality so this is not implemented yet.</p> Heap (Priority Queue) extension type in Python 2.2 (Python) 2003-12-04T20:24:15-08:00Tim Meehanhttp://code.activestate.com/recipes/users/1510937/http://code.activestate.com/recipes/252496-heap-priority-queue-extension-type-in-python-22/ <p style="color: grey"> Python recipe 252496 by <a href="/recipes/users/1510937/">Tim Meehan</a> (<a href="/recipes/tags/extending/">extending</a>). Revision 3. </p> <p>A simple example of a heap data structure as a C extension. This data structure can store and sort any python object that has a comparison function (i.e. strings, numbers, etc.).</p>