¡@

Home 

python Programming Glossary: subfunction

In Python, why doesn't exec work in a function with a subfunction?

http://stackoverflow.com/questions/4484872/in-python-why-doesnt-exec-work-in-a-function-with-a-subfunction

Python why doesn't exec work in a function with a subfunction It looks like you can't use exec in a function that has a subfunction..... It looks like you can't use exec in a function that has a subfunction... Anyone know why this Python code doesn't work I get an error.. exec 'print hi from test1 ' test1 def test2 Test with a subfunction. exec 'print hi from test2 ' def subfunction return True test2..

Python closure: Write to variable in parent scope

http://stackoverflow.com/questions/4851463/python-closure-write-to-variable-in-parent-scope

fine but I cannot increase num_converted in the second subfunction UnboundLocalError local variable 'num_converted' referenced..