nested functions
Thomas Bartkus
thomasbartkus at comcast.net
Fri Apr 14 10:21:37 EDT 2006
<micklee74 at hotmail.com> wrote in message
news:1145014674.717433.75100 at t31g2000cwb.googlegroups.com...
> hi
> just curious , if i have a code like this?
>
> def a():
> def b():
> print "b"
> def c():
> print "c"
>
> how can i call c() ??
Your function 'a' is it's own little world where functions 'b' and 'c'
exist.
Your code inside 'a' can call 'b' or 'c' - neat as you please.
BUT 'b' and 'c' simply do not exist outside the 'a' world. This is perfect
because you are in control - building worlds according to your own design.
Had it not been your intention to hide 'b' and 'c', you would not have
isolated them in this manner inside of 'a' .
I, for one, am so glad to have nested functions again ;-)
Thomas Bartkus
More information about the Python-list
mailing list