+ 1
Python's enbedded functions - what rules do apply?
I am sometimes defining a function within a function definition. It seems to me that different rules apply: Whatever I do, I can't get reading access to the global names, unless I pass them as args, and I also can't cram stuff into global containers from floor -2, like I would from floor -1. What are the differences of this kind of embedded functions and the reasons behind them? And when does it make sense to use them in the first place?
3 Respostas
+ 1
I believe you need to find out what closures are.
+ 1
Nice cue, thanks - I'll look into it!
0
Finally I got it. ^^'
Classes in the import file get imported completely; but names in the module file that start with a _ won't be imported.