[CentralOH] Syntactic Sugar (or sacharine)?

Eric Wilson wilson.eric.n at gmail.com
Fri Aug 12 20:02:43 CEST 2011


One more thing about namedtuples: I hear that they are faster than dicts.
(Someone mentioned that in the Q&A after the PyOhio talk, I haven't verified
this.)

On Fri, Aug 12, 2011 at 1:39 PM, Eric Floehr <eric at intellovations.com>wrote:

> Here is something else to ponder...
>
> >>> timeit.Timer("min.__hash__()").timeit(100000000)
> 10.986408948898315
>
> >>> timeit.Timer("'min'.__hash__()").timeit(100000000)
> 9.713651180267334
>
> >>> timeit.Timer("hash(min)").timeit(100000000)
> 8.8025760650634766
>
> >>> timeit.Timer("hash('min')").timeit(100000000)
> 5.7652111053466797
>
> Not sure at all what that means :-).  BTW, all these tests are on
> Python 2.6.5 on Ubuntu 10.04.
>
> -Eric
> _______________________________________________
> CentralOH mailing list
> CentralOH at python.org
> http://mail.python.org/mailman/listinfo/centraloh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/centraloh/attachments/20110812/9bbcffd5/attachment.html>


More information about the CentralOH mailing list