Quick actions

cmd+k|ctrl+k

Navigation

Languages

function address4

Snippet info

Language

Python

Visibility

public

Author

fai

Created

2024-08-16T08:14:19.648954Z

Updated

2024-08-16T08:50:22.8757Z

def a(x, y):
    print("I am from function a")
    return x(y)
def b(z):
#    z()    run the function outside def b(z) on line 13
    print("I am from function b")
    def d():
        print("I am from inner function d")
    z() #run the function on line 13
    def c():       #register the address of function c with the content below. Function c is not run until function c is called outside on line 9.
        print("I am from function c")
    return c, d #return only 1 value out as a tuple (c, d)
def d():
    print("I am from function d")

a(b,d)[1]() #(c, d)[1]()
a(b,d)[0]() #(c, d)[0]()
INFO