Aug-11-2018, 04:58 AM
(Aug-10-2018, 08:32 PM)Vysero Wrote: Good question but I am going to skirt around the answer because I believe inner functions are used in python because (as you found out) they are protected. At least, that's what I have gathered so far (also new to python). There kind of like a private function in that their functionality is protected from the global scope.
In other words there is essentially no good reason or time when you are going to want to use method nested within another method and if you did you wouldn't.. instead, you would just make a private method completely separate from the other. If your still interested:
def functOuter(): print("funcOuter() called") def functInner(): print("funcInner() called") functInner() functOuter()
In your example, you are calling the inner function from the outer function, and it can be easily called because it in scope of it. It simply mean that we cannot call an inner function (from the class level scope or outer scope) because they are protected?