Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not meaning when the comprehension is invoked, but during each iteration of the loop within the comprehension.

When doing something like `map(lambda x: 2+x, range(100))`, there will be 101 frames created: the outer frame, and 100 for each invocation of the lambda.

Whereas `[2+x for x in range(100)]` will only create 2: one for the outer frame, and one for the comprehension.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: