Popular recipes tagged "dynamic"http://code.activestate.com/recipes/tags/dynamic/2016-10-31T21:53:30-07:00ActiveState Code RecipesEasily create a Python REPL in Python (Python)
2016-10-31T21:53:30-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580712-easily-create-a-python-repl-in-python/
<p style="color: grey">
Python
recipe 580712
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/code_module/">code_module</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/evaluation/">evaluation</a>, <a href="/recipes/tags/read_eval_print_loop/">read_eval_print_loop</a>, <a href="/recipes/tags/repl/">repl</a>).
</p>
<p>This recipe shows how to easily create a Python REPL (Read-Eval-Print Loop) in Python itself. This can allow the user to interact with a running Python program, including typing in Python statements at the REPL prompt, defining functions, using and changing variables that were set before the interaction started, and those variables modified during the interaction, will persist in the memory of the program, for any use, even after the interaction is over, as long as the program continues to run.</p>
Drive which Python functions are executed via a text file (Python)
2016-06-12T15:27:59-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580681-drive-which-python-functions-are-executed-via-a-te/
<p style="color: grey">
Python
recipe 580681
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/adapter/">adapter</a>, <a href="/recipes/tags/configuration/">configuration</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/dynamic_method/">dynamic_method</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/runtime/">runtime</a>).
</p>
<p>This recipe shows a simple way of externally controlling which Python functions (out out of some) in your program get executed. The control is done at run time, so no code changes to the program are needed, for different choices. The control is done using a text file.</p>
Wav audio file dynamic range compressor (C)
2013-04-18T15:04:25-07:00Granning Stolinehttp://code.activestate.com/recipes/users/4186069/http://code.activestate.com/recipes/578510-wav-audio-file-dynamic-range-compressor/
<p style="color: grey">
C
recipe 578510
by <a href="/recipes/users/4186069/">Granning Stoline</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/compressor/">compressor</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/range/">range</a>, <a href="/recipes/tags/wav/">wav</a>).
Revision 4.
</p>
<p>Wav audio file dynamic range compressor</p>
Hamming Neighbors (Python)
2013-01-17T20:50:21-08:00Yong Shinhttp://code.activestate.com/recipes/users/4184933/http://code.activestate.com/recipes/578423-hamming-neighbors/
<p style="color: grey">
Python
recipe 578423
by <a href="/recipes/users/4184933/">Yong Shin</a>
(<a href="/recipes/tags/distance/">distance</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/hamming/">hamming</a>, <a href="/recipes/tags/programming/">programming</a>).
</p>
<p>HammingNeighbors returns all integers that are k number of bits away (i.e. k Hamming distance away) from an integer. <br />
The algorithm uses dynamic programming.</p>
Dynamically create a dictionary of ascending paths (Python)
2012-12-03T22:50:47-08:00Scott S-Allenhttp://code.activestate.com/recipes/users/4181178/http://code.activestate.com/recipes/578354-dynamically-create-a-dictionary-of-ascending-paths/
<p style="color: grey">
Python
recipe 578354
by <a href="/recipes/users/4181178/">Scott S-Allen</a>
(<a href="/recipes/tags/bootstrap/">bootstrap</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/directory/">directory</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/flexible/">flexible</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/portable/">portable</a>).
</p>
<p>Ripped from a more elaborate bootstrap script. A sequential set of parent-directories were required for environment variables and subsequent, portable. auto-discovery. </p>
Components and Abilities (different implementation of Component architecture) (Python)
2009-07-23T13:26:32-07:00Danny Ghttp://code.activestate.com/recipes/users/4164396/http://code.activestate.com/recipes/576854-components-and-abilities-different-implementation-/
<p style="color: grey">
Python
recipe 576854
by <a href="/recipes/users/4164396/">Danny G</a>
(<a href="/recipes/tags/abc/">abc</a>, <a href="/recipes/tags/ability/">ability</a>, <a href="/recipes/tags/abstract_base_class/">abstract_base_class</a>, <a href="/recipes/tags/component/">component</a>, <a href="/recipes/tags/descriptor/">descriptor</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/plugin/">plugin</a>).
Revision 6.
</p>
<p>I define a 'Component' as an attribute (typing optional) that instances can assign objects to. Nothing special there, but their usefulness comes in with 'Abilities'. If a class inherits from 'ClassWithAbilities', it will be given a special attribute 'abilities' that will grow/shrink when other classes with abilities are assigned to an instances attributes. It increases/decreases the functionality of the instance depending on what objects are assigned to it. All of these abilities are accessed through the 'abilities' attribute. This is a redesign of <a href="http://code.activestate.com/recipes/576852/"><a href="http://code.activestate.com/recipes/576852/">Recipe 576852</a></a>, but I believe is different enough to warrant a new recipe.</p>