Aak*_*ash 0 python python-2.x python-2.7
您好,我有一个奇怪的疑问..
我的代码是
def prints():
print " I WILL DIE HEHE"
def add(a,b):
next = a
print " Added sum is %d " % (next + b)
next = prints()
w = int(raw_input("Give a"))
g = int(raw_input("Give b"))
add(w,g)
Run Code Online (Sandbox Code Playgroud)
现在问题是为什么函数prints()在我将其分配给next时执行,即next = prints().我有点困惑.
因为你在叫它,
prints()
Run Code Online (Sandbox Code Playgroud)
会在哪里执行
ne = prints
ne()
Run Code Online (Sandbox Code Playgroud)
分配名称,然后调用新名称.
Noteback,我也把它ne称为next阴影内置方法