defaultdict and dict?
python at rcn.com
Sat Nov 10 00:29:39 CET 2007
On Nov 9, 3:01 am, Davy <zhushe... at gmail.com> wrote:
> In Python 2.5 document, defaultdict is called high performance
> container. From document, we can know defaultdict is subclass of dict.
> So, why defaultdict have higher performance than dict? And at what
> circumstance, we can make use of such high performance?
Defaultdicts only area of superiority is the speed and code economy
for the case where you need to automatically fill-in missing values
(it runs circles around dict.setdefault).
More information about the Python-list