Latest recipes tagged "aspect"http://code.activestate.com/recipes/tags/aspect/new/2017-01-11T10:10:30-08:00ActiveState Code RecipesRetry Decorator in Python (Python)
2017-01-11T10:10:30-08:00Alfehttp://code.activestate.com/recipes/users/4182236/http://code.activestate.com/recipes/580745-retry-decorator-in-python/
<p style="color: grey">
Python
recipe 580745
by <a href="/recipes/users/4182236/">Alfe</a>
(<a href="/recipes/tags/aspect/">aspect</a>, <a href="/recipes/tags/except/">except</a>, <a href="/recipes/tags/exception/">exception</a>, <a href="/recipes/tags/retry/">retry</a>, <a href="/recipes/tags/try/">try</a>).
</p>
<p>This is a Python decorator which helps implementing an aspect oriented implementation of a <em>retrying</em> of certain steps which might fail sometimes. A typical example for this would be communication processes with the outside world, e. g. HTTP requests, allocation of some resource, etc. To use it, refactor the step in question into a (local) function and decorate this with the <code>retry</code> decorator. See examples in the discussion sector below.</p>
Elegant (?) AoP for methods and functions (Python)
2010-03-02T20:10:38-08:00Alec Thomashttp://code.activestate.com/recipes/users/2870300/http://code.activestate.com/recipes/577082-elegant-aop-for-methods-and-functions/
<p style="color: grey">
Python
recipe 577082
by <a href="/recipes/users/2870300/">Alec Thomas</a>
(<a href="/recipes/tags/aop/">aop</a>, <a href="/recipes/tags/aspect/">aspect</a>, <a href="/recipes/tags/join/">join</a>, <a href="/recipes/tags/oriented/">oriented</a>, <a href="/recipes/tags/point/">point</a>).
Revision 2.
</p>
<p>There are a couple of other AoP related recipes on ASPN. This one is designed to have a simple, elegant interface.</p>