Top-rated recipes tagged "instance"http://code.activestate.com/recipes/tags/instance/top/2013-02-28T04:14:08-08:00ActiveState Code RecipesAll [iter] is Instance of [class/type/tuple] (Python)
2012-07-26T18:09:30-07:00Jonathan Frerehttp://code.activestate.com/recipes/users/4182985/http://code.activestate.com/recipes/578226-all-iter-is-instance-of-classtypetuple/
<p style="color: grey">
Python
recipe 578226
by <a href="/recipes/users/4182985/">Jonathan Frere</a>
(<a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/instance/">instance</a>, <a href="/recipes/tags/isinstance/">isinstance</a>).
Revision 2.
</p>
<p>So it turned out that I needed a way of ensuring that all members of an iterable are instances of a certain class. Here, therefore, is the <code>isallinstance()</code> function.</p>
Python single instance (cross-platform) (Python)
2013-02-10T16:22:33-08:00Esteban Castro Borsanihttp://code.activestate.com/recipes/users/4184010/http://code.activestate.com/recipes/578453-python-single-instance-cross-platform/
<p style="color: grey">
Python
recipe 578453
by <a href="/recipes/users/4184010/">Esteban Castro Borsani</a>
(<a href="/recipes/tags/application/">application</a>, <a href="/recipes/tags/instance/">instance</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/single/">single</a>, <a href="/recipes/tags/singleton/">singleton</a>).
</p>
<p>Yet another way to get a single instance application.
This recipe uses file locking only.</p>
to change instance to immutable (Python)
2011-08-08T05:52:18-07:00KATO Kanryuhttp://code.activestate.com/recipes/users/4178894/http://code.activestate.com/recipes/577831-to-change-instance-to-immutable/
<p style="color: grey">
Python
recipe 577831
by <a href="/recipes/users/4178894/">KATO Kanryu</a>
(<a href="/recipes/tags/immutable/">immutable</a>, <a href="/recipes/tags/instance/">instance</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>make a class instance to immutable one.
we can call fields, methods, and properties.
This airms to make easier to develop multi thread object-oriented programming.</p>
Design Pattern -- Inherit from an instance (Python)
2010-02-22T06:04:16-08:00Daniel Cohnhttp://code.activestate.com/recipes/users/4172918/http://code.activestate.com/recipes/577026-design-pattern-inherit-from-an-instance/
<p style="color: grey">
Python
recipe 577026
by <a href="/recipes/users/4172918/">Daniel Cohn</a>
(<a href="/recipes/tags/design_pattern/">design_pattern</a>, <a href="/recipes/tags/factory_class/">factory_class</a>, <a href="/recipes/tags/inheritance/">inheritance</a>, <a href="/recipes/tags/instance/">instance</a>).
Revision 4.
</p>
<p>Take an instance (call it foo) and create a factory class (call it InstanceFactory) that produces foo's. Then inherit from InstanceFactory.</p>
Python single instance (cross-platform) (Python)
2013-02-28T04:14:08-08:00Deepakhttp://code.activestate.com/recipes/users/4183429/http://code.activestate.com/recipes/578476-python-single-instance-cross-platform/
<p style="color: grey">
Python
recipe 578476
by <a href="/recipes/users/4183429/">Deepak</a>
(<a href="/recipes/tags/application/">application</a>, <a href="/recipes/tags/instance/">instance</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/single/">single</a>, <a href="/recipes/tags/singleton/">singleton</a>).
</p>
<p>Yet another way to get a single instance application.
This recipe uses file locking only.</p>