<br><br><div><span class="gmail_quote">On 8/11/06, <b class="gmail_sendername">Collin Winter</b> <<a href="mailto:collinw@gmail.com">collinw@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
>>> def chain(*decorators):<br>>>> assert len(decorators) >= 2<br>>>><br>>>> def decorate(function):<br>>>> sig = function.__signature__<br>>>> original =
sig.annotations<br>>>><br>>>> for i, dec in enumerate(decorators):<br>>>> fake = dict((p, original[p][i]) for p in original)<br>>>><br>>>> function.__signature__.annotations = fake
<br>>>> function = dec(function)<br>>>><br>>>> function.__signature__.annotations = original<br>>>> return function<br>>>> return decorate</blockquote>
<div><br>I must be confused. This is a function returning a function. Does that mean that the thing showing up in the __signatures__ dictionary is a function? Or does the caller need to use two sets of parentheses to call the factory function and then the inner function?
<br><br> Paul Prescod<br><br></div></div><br>