Use list instead of an iterator in Python 3