Python3: on removing map, reduce, filter

Steven Bethard steven.bethard at gmail.com
Mon Jan 10 01:12:58 EST 2005


John Machin wrote:
> Steven Bethard wrote:
>> Note that list comprehensions are also C-implemented, AFAIK.
> 
> Rather strange meaning attached to "C-implemented". The implementation
> generates the code that would have been generated had you written out
> the loop yourself, with a speed boost (compared with the fastest DIY
> approach) from using a special-purpose opcode LIST_APPEND. See below.

Fair enough. ;)

So you basically replace the SETUP_LOOP, CALL_FUNCTION, POP_TOP and 
POP_BLOCK with a DUP_TOP and a LIST_APPEND.

Steve



More information about the Python-list mailing list