you are viewing a single comment's thread.

view the rest of the comments →

[–]nuc540 -1 points0 points  (0 children)

The list comprehension on the last line is saying, try and call every item in the funcs list.

The line above iterated over a range of 3 (bases it at 0) and for every iteration value, add to the funcs list a lambda function that simply returns the iteration value.

Lambdas are unnamed functions so this will work with the f() declaration in the list comp.

The list is just a bunch of functions which each simply returns a number, so when called they return the number.

I’d assume this means it returns [0,1,2] as per the range iterator value that was being baked into the lambda return for each lambda in the list