Jan Hermann added the comment:
Ok, that’s fair. But then the inspect module currently doesn’t provide tools to
the user to construct the recursive identification without duplicating code
already in stdlib. For that, one would need to refactor getclosurevars() to two
parts: getcode() and getcl
Josh Rosenberg added the comment:
Problem: The variables from the nested functions (which comprehensions are
effectively a special case of) aren't actually closure variables for the
function being inspected.
Allowing recursive identification of all closure variables might be helpful in
some
New submission from Jan Hermann :
inspect.getclosurevars() omits globals or nonlocals that are bound within
comprehensions:
22:50 ~ python3
Python 3.7.0 (default, Aug 17 2018, 21:14:48)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more inform