On 02/03/2022 01:32, Rob Cliffe via Python-list wrote:
itertools.product returns an iterator (or iterable, I'm not sure of the correct technical term).
There's a simple test: iter(x) is x --> True # iterator iter(x) is x --> False # iterable So: >>> from itertools import product >>> p = product("ab", [1, 2]) >>> iter(p) is p # iterator True >>> items = [1, 2] # iterable >>> iter(items) is items False Another interesting property of (finite) iterators/iterables list(iterable) == list(iterable) --> Generally True, but not guaranteed. a = list(iterator) # whatever b = list(iterator) # [] (*) (*) Kill the coder if that doesn't hold ;) -- https://mail.python.org/mailman/listinfo/python-list