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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to