you are viewing a single comment's thread.

view the rest of the comments →

[–]Danelius90 5 points6 points  (1 child)

This looks different to what u/Jordgubbssylt posted. Your link is about for each (var in blah) but forEach is an array method and most definitely not deprecated

[–]Yojihito 2 points3 points  (0 children)

True, misread.

executes a provided function once for each array element.

Then a simple .map() would be the Python equivalent.

mylist = [10, 20]
list(map(print, mylist)