"Frank Millman" <fr...@chagford.com> writes:

> It seems that a dict comp is noticeably faster.
>
> Does this sound right, or are there other factors I should be taking into 
> account?

The dict comp does not execute any function call. Consider the following:

    $ python3 -m timeit "d=dict()"
    10000000 loops, best of 3: 0.113 usec per loop
    $ python3 -m timeit "d={}"
    10000000 loops, best of 3: 0.0601 usec per loop

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  |                 -- Fortunato Depero, 1929.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to