Monty @ The Python Coding Place @thepythoncodingplace.com · Mar 7

But you want to use the function `inner()` in your main program, so you need to return it from `print_with_memory()` And therefore, you can now define `print_` as the function that `print_with_memory()` returns. `print_` is the same as `inner`

0 likes 1 replies

?

Replies

Monty @ The Python Coding Place · Mar 7

But, and here's the key point, this function `print_()`, which is the function `inner()` returned by `print_with_memory()`, also has access to the list `data` even though it's not part of its local scope.