Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

closures in python

def make_summer():

    data = []

    def summer(val):

        data.append(val)
        _sum = sum(data)

        return _sum

    return summer
Source by zetcode.com #
 
PREVIOUS NEXT
Tagged: #closures #python
ADD COMMENT
Topic
Name
9+7 =