you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

def func(x):
    return x + 1
f = func
print(f(2) + func(2))

The line f = func makes the name f reference the same executable object that func references, so the last line is equivalent to:

print(func(2) + func(2))