Simpler way to run a generator function without caring about items

前端 未结 4 1252
温柔的废话
温柔的废话 2020-12-17 17:20

I have some use cases in which I need to run generator functions without caring about the yielded items.
I cannot make them non-generaor functions because in other use c

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-17 18:02

    Based on your use case it's hard to imagine that there would be sufficiently many tables to create that you would need to consider performance.

    Additionally, table creation is going to be much more expensive than iteration.

    So the for loop that you already have would seem the simplest and most Pythonic solution - in this case.

提交回复
热议问题