I have this simple piece of code that returns what\'s in the title. Why doesn\'t the array simply print? This is not just an itertools
issue I\'ve also notice
It doesn't print a simple list because the returned object is not a list. Apply the list
function on it if you really need a list.
print list(itertools.combinations(number, 4))
itertools.combinations
returns an iterator. An iterator is something that you can apply for
on. Usually, elements of an iterator is computed as soon as you fetch it, so there is no penalty of copying all the content to memory, unlike a list
.