> Answering my own question (sorry), this works: > > > def functions(): > result = [] > for i in range(10): > def make_function(index): > def mth(): > return index > return mth > mth = make_function(i) > result.append(mth) > i = 25 > return result > > for mth in functions(): > print mth() > > But how will I understand this 3 months from now? What's the problem with understanding this code? It looks totally clear to me. You could add a few comments or use more fancyful function names. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4