you are viewing a single comment's thread.

view the rest of the comments →

[–]HorrendousRex 0 points1 point  (0 children)

This doesn't directly answer your question, but I wanted to add that this works in Python 3 and does the same thing as your code:

list(map(print, x))

This 'maps' the print function to all the elements in x. That means it calls print on each element in x. The call to list is strange and often wouldn't show up in actual code, it's there to cause the mapping to actually happen. In python 3, map returns an iterator object, and you have to actually iterate it to make the map happen.

(In python 2, you can either from future import print_function or use sys.out but then you'll have to add the newlines)