What is the difference between chain and chain.from_iterable in itertools?

前端 未结 6 1306
庸人自扰
庸人自扰 2020-12-07 20:05

I could not find any valid example on the internet where I can see the difference between them and why to choose one over the other.

6条回答
  •  离开以前
    2020-12-07 20:23

    Another way to look at it is to use chain.from_iterable

    when you have an iterable of iterables like a nested iterable(or a compound iterbale) and use chain for simple iterables

提交回复
热议问题