reversing a dictionary (newbie)

David Bolen db3l at fitlinxx.com
Thu Mar 15 17:57:46 EST 2001


Steve Purcell <stephen_purcell at yahoo.com> writes:

> Expect total memory usage to be triple that of 'dict' alone towards the end
> of the loop, because of the 'items()' call.

Of course, "triple that of 'dict' alone" covers the object references
in the dictionary, but not triple the overall object space, since both
the items() list and the new dictionary just have references to the
same objects.  So you'll only have space allocated for the actual word
strings themselves once in the application.

Which can make this much less overhead than might otherwise be
considered at first glance.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list