
#411: Things I Wish Someone Had Explained To Me Sooner About Python
Talk Python To Me
00:00
The Magic of List Completion
Carl Meyer put out a PEP 709 called inlined list comprehensions, which are supposed to take some of the mostly invisible behind the scene implementation and make comprehensions two times faster. What is a list comprehension? It's a generator expression that is being unpacked into a list. And if you just wrap it in parentheses, you can use it as a generator when you change those square brackets to be square brackets. So now they create a new load fast and clear bytecode operation that like stores the state of the function then does the list comprehension and then pops it back off the stack to unwind it.
Transcript
Play full episode