Performance of list comprehensions vs. map

Skip Montanaro skip at pobox.com
Sun Sep 9 21:51:16 EDT 2001


    >> > func_code has been writable for some time.  Here under 2.2a3:
    >> > 
    >> > >>> def f():
    >> > ...     pass
    >> > ...
    >> > >>> def g():
    >> > ...     return 666
    >> > ...
    >> > >>> f.func_code = g.func_code
    >> > >>> f()
    >> > 666
    >> 
    >> this really makes optimizing even harder than I thought, and I always
    >> thought it was hard.

    Tim> Yep - now you know why so many people have *not* put the effort
    Tim> into optimising Python. Dynamism pervades almost every part of the
    Tim> language.

I don't see how substituting one code object for another makes optimizing a
function any harder or easier.

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list