Latest recipes tagged "record" Code RecipesPseudoStruct (Python) 2012-11-25T03:43:06-08:00Matthew Zipay <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="" rel="nofollow"></a>) and recordtype (<a href="" rel="nofollow"></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> Restricted dictionary (Python) 2012-02-16T21:39:02-08:00arnoques <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 Walker <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> typesafe records (Python) 2010-07-10T01:43:38-07:00andrew johnson <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> Records (Python) 2008-11-04T06:52:42-08:00George Sakkis <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="" rel="nofollow"></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>