Recursive python variables referenced or copied?

I have the following recursive function, and it's hard for me to understand how python handles variables in recursive functions. Will it create a copy of the variable addressesfor each recursion, or will it overwrite the variable and create a terrible mess?

def get_matches():
    addresses = get_addresses()

    #do stuff

    for addr in addresses:
        #do stuff
        if some_condition:
            get_matches()
        else:
            return
+4
source share
1 answer

The underline concept you are looking for is called a frame .

Python , . , Python , . . , .

, . , . , address, , .

, . , Python . Python , , .

+4

Source: https://habr.com/ru/post/1686976/


All Articles