adplus-dvertising
frame-decoration

Question

In the code shown below, which function is the decorator?
def mk(x):
    def mk1():
        print("Decorated")
        x()
    return mk1
def mk2():
    print("Ordinary")
p = mk(mk2)
p()

a.

p()

b.

mk()

c.

mk1()

d.

mk2()

Posted under Python

Answer: (b).mk()

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. In the code shown below, which function is the decorator?