Top-rated recipes tagged "record"http://code.activestate.com/recipes/tags/record/top/2012-11-25T03:43:06-08:00ActiveState Code RecipesRecords (Python)
2008-11-04T06:52:42-08:00George Sakkishttp://code.activestate.com/recipes/users/2591466/http://code.activestate.com/recipes/576555-records/
<p style="color: grey">
Python
recipe 576555
by <a href="/recipes/users/2591466/">George Sakkis</a>
(<a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/namedtuple/">namedtuple</a>, <a href="/recipes/tags/record/">record</a>).
</p>
<p>This is a recipe similar in functionality and exec-style optimized implementation to the very well received namedtuple (<a href="http://code.activestate.com/recipes/500261/" rel="nofollow">http://code.activestate.com/recipes/500261/</a>) that was included in Python 2.6. The main difference is that <strong>records</strong>, unlike named tuples, are mutable. In addition, fields can have a default value. Instead of subclassing tuple or list, the implementation create a regular class with __slots__.</p>
PseudoStruct (Python)
2012-11-25T03:43:06-08:00Matthew Zipayhttp://code.activestate.com/recipes/users/4183355/http://code.activestate.com/recipes/578349-pseudostruct/
<p style="color: grey">
Python
recipe 578349
by <a href="/recipes/users/4183355/">Matthew Zipay</a>
(<a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/namedtuple/">namedtuple</a>, <a href="/recipes/tags/record/">record</a>).
</p>
<p>This is a recipe for a Python "data object." It is similar in function to namedtuple (<a href="http://code.activestate.com/recipes/500261/" rel="nofollow">http://code.activestate.com/recipes/500261/</a>) and recordtype (<a href="http://code.activestate.com/recipes/576555-records/" rel="nofollow">http://code.activestate.com/recipes/576555-records/</a>) in that it is a simple container for data, but is designed to meet three specific goals:</p>
<ol>
<li>Easy to subclass data objects.</li>
<li>Get/set speed comparable to a simple class.</li>
<li>Minimal memory consumption per instance.</li>
</ol>
typesafe records (Python)
2010-07-10T01:43:38-07:00andrew johnsonhttp://code.activestate.com/recipes/users/4174071/http://code.activestate.com/recipes/577249-typesafe-records/
<p style="color: grey">
Python
recipe 577249
by <a href="/recipes/users/4174071/">andrew johnson</a>
(<a href="/recipes/tags/namedtuple/">namedtuple</a>, <a href="/recipes/tags/record/">record</a>, <a href="/recipes/tags/type/">type</a>, <a href="/recipes/tags/typesafe/">typesafe</a>).
Revision 4.
</p>
<p>A typesafe wrapper for namedtuple.</p>
Restricted dictionary (Python)
2012-02-16T21:39:02-08:00arnoqueshttp://code.activestate.com/recipes/users/4180947/http://code.activestate.com/recipes/578042-restricted-dictionary/
<p style="color: grey">
Python
recipe 578042
by <a href="/recipes/users/4180947/">arnoques</a>
(<a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/dict/">dict</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/record/">record</a>).
</p>
<p>It's a dictionary that's restricted to a tuple of allowed keys. Any attempt to set an invalid key raises an error.</p>
Record and Playbac using standard Python. (Python)
2011-02-25T19:33:59-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577587-record-and-playbac-using-standard-python/
<p style="color: grey">
Python
recipe 577587
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/playback/">playback</a>, <a href="/recipes/tags/record/">record</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>This very simple DEMO code records a few seconds of your voice from a microphone, (internal mic' on a laptop), and
replays your voice immedaiately after recording. It goes without saying that the RAW recording can be saved in
any extension of your choice and used as error reporting using the playback method.</p>
<p>There is the possibility of using it as a simple means of a single channel audio oscilloscope using the external
mic input and suitable Python GUI or with simple home built HW a seismometer recorder, plus other ideas.</p>
<p>Enjoy finding simple solutions to often very difficult problems...</p>
<p>Read the code for more information...</p>
<p>73...</p>
<p>Bazza, G0LCU...</p>
<p>Team AMIGA...</p>