Author ncoghlan
Recipients aliles, daniel.urban, eric.araujo, ezio.melotti, flox, jcea, meador.inge, ncoghlan, rhettinger
Date 2013-07-15.12:55:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373892932.19.0.713383579944.issue13266@psf.upfronthosting.co.za>
In-reply-to
Content
Added a version that allows the iteration to be terminated early if certain criteria are met, which is needed for a robust implementation of inspect.signature.

However, I'm thinking the callback based approach in this version isn't especially Pythonic, so I'm thinking it may be better to change the API to a generator function. That way the iterator can still take care of the wrapper loop detection, without needing the clumsy predicate API for early termination.

Instead, you would just use an ordinary search loop, and if you wanted the innermost function unconditionally you could do something like:

    for f in functools.unwrap(original): pass
    # f is now the innermost function
History
Date User Action Args
2013-07-15 12:55:32ncoghlansetrecipients: + ncoghlan, rhettinger, jcea, ezio.melotti, eric.araujo, flox, meador.inge, daniel.urban, aliles
2013-07-15 12:55:32ncoghlansetmessageid: <1373892932.19.0.713383579944.issue13266@psf.upfronthosting.co.za>
2013-07-15 12:55:32ncoghlanlinkissue13266 messages
2013-07-15 12:55:31ncoghlancreate