[stackoverflow翻译] “yield” 关键字有什么用?what-does-the-yield-keyword-do
问:
在Python中 yield 关键字有什么用?
他是做什么的?
例如,我正在尝试理解下面的代码1:
def _get_child_candidates(self, distance, min_dist, max_dist):
if self._leftchild and distance - max_dist self._median:
yield
原创
2017-02-07 20:41:54 ·
386 阅读 ·
0 评论