R
Rim
Hi,
I am reading the document http://www.python.org/2.2.1/descrintro.html
"This is not always what you want; in particular, using a separate
dictionary to hold a single instance variable doubles the memory used
by a defaultdict instance compared to using a regular dictionary!"
I don't understand what is the separate dictionary Guido is talking
about.
I also don't understand how one additional entry (the 'default' entry)
in the dictionary doubles the dictionary size... except when the
dictionary has only one
element, then of course, adding another element will cause it double
in
number of elements.
Thanks,
- Rim
I am reading the document http://www.python.org/2.2.1/descrintro.html
"This is not always what you want; in particular, using a separate
dictionary to hold a single instance variable doubles the memory used
by a defaultdict instance compared to using a regular dictionary!"
I don't understand what is the separate dictionary Guido is talking
about.
I also don't understand how one additional entry (the 'default' entry)
in the dictionary doubles the dictionary size... except when the
dictionary has only one
element, then of course, adding another element will cause it double
in
number of elements.
Thanks,
- Rim