What is a closure in Python?

Last updated:9/19/2020 6:27:07 AM

1 Answers

Prakash nidhi Verma
Prakash nidhi Verma

A closure is a event in python. its occur when a nested function doing references a value in its enclosing scope.The whole point here is that it remembers the value. 

>>> def A(x): 
    def B():
    return B
>>> A(7)()