Nick Coghlan added the comment: 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 ---------- Added file: http://bugs.python.org/file30927/issue13266_inspect_unwrap_4.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13266> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com