如果您有任何疑问,可以访问python的repl并尝试使用值和函数。有一个
type()
可用于值和函数的指令,例如:
Python 3.6.2 (default, Jul 19 2017, 13:09:21)
[GCC 7.1.1 20170622 (Red Hat 7.1.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo():
... y=5
... return y
...
>>> type(foo())
<class 'int'>
关于你的
foo()
函数,
y
是保存值的本地绑定
int
.
return
语句返回变量值
Y
这个绑定在
英尺()
功能范围。