list() applied to zip object twice in a row issue list() applied to zip object twice in a row issue python-3.x python-3.x

list() applied to zip object twice in a row issue


zip returns a generator, not list. generator only runs once, so you will need to recall zip again for my_map_list_second


You are looking for awnser about generator.

In fact, zip will create a generator, that is not process until you iterate trought it, using list in your exemple. An other important property is that generator can only be iterate once.

The last property explain why you get en empty list the second time.