Why aren’t python nested functions called closures?

I have seen and used nested functions in Python, and they match the definition of a closure. So why are they called nested functions instead of closures?

Are nested functions not closures because they are not used by the external world?

UPDATE: I was reading about closures and it got me thinking about this concept with respect to Python. I searched and found the article mentioned by someone in a comment below, but I couldn’t completely understand the explanation in that article, so that is why I am asking this question.

9 Answers
9

Leave a Comment