Why passing a list as a parameter performs better than passing a generator?
问题 I was making an answer for this question, and when I tested the timing for my solution I came up with a contradiction to what I thought was correct. The guy who made the question wanted to find a way to know how many different lists were contained within another list. (for more information, you can check the question) My answer was basically this function: def how_many_different_lists(lists): s = set(str(list_) for list_ in lists) return len(s) Now, the situation came when I measured the time