{{ message }}
Commit 34be2ea
authored
修改为更准确的描述
itertools.chain(*files)导致gen_opener()生成器被提前全部消费掉,因此在此场景不适合,参见原文https://www.safaribooksonline.com/library/view/python-cookbook-3rd/9781449357337/ch04s13.html。但仍可以用yield from itertools.chain.from_iterable(files),itertools.chain.from_iterable相对于itertools.chain,它是懒消费的。
见https://stackoverflow.com/questions/15004772/what-is-the-difference-between-chain-and-chain-from-iterable-in-itertools。1 parent f53ef07 commit 34be2ea
1 file changed
Lines changed: 1 addition & 1 deletion

0 commit comments