creating really big lists

Gabriel Genellina gagsl-py2 at
Sat Sep 8 03:33:36 CEST 2007

En Fri, 07 Sep 2007 16:16:46 -0300, Dr Mephesto <dnhkng at>  

> hey, that defaultdict thing looks pretty cool...
> whats the overhead like for using a dictionary in python?

Dictionaries are heavily optimized in Python. Access time is O(1),  
adding/removing elements is amortized O(1) (that is, constant time unless  
it has to grow/shrink some internal structures.)

Gabriel Genellina

More information about the Python-list mailing list