`返回线,`和`返回线`之间的区别 [英] Difference between `return line, ` and `return line`
本文介绍了`返回线,`和`返回线`之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我最近的一个问题中,我引用了杰克范德普拉斯.可以找到以下代码:
In a recent question of mine, I quote some code by Jake Vanderplas. One can find the following code:
from matplotlib import pyplot as plt
from matplotlib import animation
fig = plt.figure()
ax = plt.axes(xlim=(0, 2), ylim=(0, 100))
line, = plt.plot([], [])
def init():
line.set_data([], [])
return line,
def animate(i):
line.set_data([0, 2], [0,i])
return line,
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=100, interval=20, blit=True)
plt.show()
在 init
或 animate
函数中,返回的值"是 line
(带逗号).
In the init
or animate
function, the return "value" is line,
(with a comma).
问题:line
(不含逗号)的返回值"是否有区别?
Question: Is there a difference with a return "value" that would be line
(whitout comma)?
谢谢
推荐答案
line,
是一个包含一个对象的元组. line
只是行对象.
line,
is a tuple with one object in it.
line
is just the line object.
In [80]: line = object()
In [81]: line,
Out[81]: (<object at 0x9ee7fa8>,)
这篇关于`返回线,`和`返回线`之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文