Popular recipes tagged "ability"http://code.activestate.com/recipes/tags/ability/2009-07-23T13:26:32-07:00ActiveState Code RecipesComponents 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>