Terry Reedy: >The problem is that inner functions do not exist until the outer function is >called and the inner def is executed. And they cease to exist when the outer >function returns unless returned or associated with a global name or >collection.<
OK. >A 'function' only needs to be nested if it is intended to be different >(different default or closure) for each execution of its def.< Or maybe because you want to denote a logical nesting, or maybe because you want to keep the outer namespace cleaner, etc etc. ----------------------- Benjamin: >Of course, you could resort to terrible evil like this:< My point was of course to ask about possible changes to CPython, so you don't need evil hacks anymore. ----------------------- Steven D'Aprano: >For this to change wouldn't be a little change, it would be a large change.< I see, then my proposal has little hope, I presume. I'll have to keep moving functions outside to test them and move them inside again when I want to run them. >However you can get the same result (and arguably this is the Right Way to do >it) with a class:< Of course, that's the Right Way only for languages that support only a strict form of the Object Oriented paradigm, like for example Java. Thank you to all the people that have answered. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list