Popular recipes tagged "meta:loc=184"http://code.activestate.com/recipes/tags/meta:loc=184/2013-12-27T06:43:59-08:00ActiveState Code RecipesPublic Key Encryption (RSA) (Python) 2013-12-27T06:43:59-08:00Mohammad Taha Jahangirhttp://code.activestate.com/recipes/users/4188847/http://code.activestate.com/recipes/578797-public-key-encryption-rsa/ <p style="color: grey"> Python recipe 578797 by <a href="/recipes/users/4188847/">Mohammad Taha Jahangir</a> (<a href="/recipes/tags/encryption/">encryption</a>, <a href="/recipes/tags/inverse/">inverse</a>, <a href="/recipes/tags/multiplicative/">multiplicative</a>, <a href="/recipes/tags/primality_testing/">primality_testing</a>, <a href="/recipes/tags/primes/">primes</a>, <a href="/recipes/tags/publickey/">publickey</a>, <a href="/recipes/tags/rsa/">rsa</a>). Revision 3. </p> <p>Simple code to create and use public/private keypairs. Accompanied by a rudimentary encoder.</p> Conway's Game of Life In Python (Python) 2013-06-13T15:33:41-07:00alexander bakerhttp://code.activestate.com/recipes/users/4166679/http://code.activestate.com/recipes/578559-conways-game-of-life-in-python/ <p style="color: grey"> Python recipe 578559 by <a href="/recipes/users/4166679/">alexander baker</a> (<a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/life/">life</a>, <a href="/recipes/tags/numpy/">numpy</a>, <a href="/recipes/tags/of/">of</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>Conway's Game of Life In Python</p> A simple enum type (Python) 2013-02-13T06:53:38-08:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/578455-a-simple-enum-type/ <p style="color: grey"> Python recipe 578455 by <a href="/recipes/users/4177816/">Eric Snow</a> (<a href="/recipes/tags/enum/">enum</a>, <a href="/recipes/tags/metaclass/">metaclass</a>). Revision 2. </p> <p>Inspired by various threads[1] on the python-ideas list, here's a simple enum type. Enums are generated either via the class syntax or via Enum.make().</p> <pre class="prettyprint"><code>class Breakfast(Enum): SPAM, HAM, EGGS BACON, SAUSAGE Breakfast = Enum.make("SPAM HAM EGGS BACON SAUSAGE") </code></pre> <p>Here are some of the features:</p> <p>Enum:</p> <ul> <li>inheriting from an enum inherits copies of its values.</li> <li>the export() method allows for exposing an enum's values in another namespace.</li> </ul> <p>Enum Values:</p> <ul> <li>the underlying values within an enum are essentially useless, diminishing the temptation to rely on them.</li> <li>identity is equality, like with None, True, and False.</li> <li>enum values support bitwise operations within the same enum.</li> <li>the result of a bitwise operation is always the same object given the same inputs.</li> </ul> <p>[1] see <a href="http://mail.python.org/pipermail/python-ideas/2013-January/019003.html" rel="nofollow">http://mail.python.org/pipermail/python-ideas/2013-January/019003.html</a></p> Simple event dispatcher (Python) 2010-10-19T21:18:45-07:00Daniele Espostihttp://code.activestate.com/recipes/users/4174769/http://code.activestate.com/recipes/577432-simple-event-dispatcher/ <p style="color: grey"> Python recipe 577432 by <a href="/recipes/users/4174769/">Daniele Esposti</a> (<a href="/recipes/tags/dispatcher/">dispatcher</a>, <a href="/recipes/tags/event/">event</a>). </p> <p>An example of a simple event dispatcher mini-framework</p> Sort extremely large and/or binary files in Python (Python) 2008-02-18T18:46:39-08:00Jeremy Mortishttp://code.activestate.com/recipes/users/4126022/http://code.activestate.com/recipes/546524-sort-extremely-large-andor-binary-files-in-python/ <p style="color: grey"> Python recipe 546524 by <a href="/recipes/users/4126022/">Jeremy Mortis</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>This recipe can be used to sort very large files (millions of records) in Python. No record termination character is required, hence a record may contain embedded binary data, newlines, etc. You can specify how many temporary files to use and where they are located.</p>