Aaron Iles added the comment:

My +1 is for the callback based approach. The brevity of the search loop for 
finding the innermost function is (in my opinion at least) non-obvious, relying 
on for loops not having their own scope as it does.

If a generator based API was adopted instead, I propose a convenience function 
(unwrap_all?) to help developers avoid writing code like:

    inner = None
    for inner in functools.unwrap(outer):
    if inner is None:
        inner = outer

Which combines a misunderstanding of the API with for loop scope shortcut.


Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list

Reply via email to