|
|
|
|
|
by warbiscuit
3653 days ago
|
|
I'm not positive, but I think it saves the need to create a new execution frame for each lambda call, since the whole loop executes in single frame used by the comprehension. In theory I suppose the VM could have a map() implementation which opportunistically extracts the code from a lambda and inlines them when possible; but doubt CPython does that. OTOH, I'd be surprised if PyPy doesn't do something like that. |
|
[1] http://python-history.blogspot.com/2010/06/from-list-compreh...