This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josh.r
Recipients benjamin.peterson, josh.r, larry, marmoute, mpm, rhettinger
Date 2015-04-17.00:06:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
You shouldn't presize when the input is a potentially non-unique iterable. It makes sense to presize for inputs of type dict or set, but for a list, the assumption is that many duplicates will be present, since deduping is a common use case for dicts (less so with the advent of sets, but still common enough to support without massive overallocation of memory).

In short, dict([(1, 2)] * 1000000) should not involve allocating GB of memory for the dict up front.
Date User Action Args
2015-04-17 00:06:55josh.rsetrecipients: + josh.r, rhettinger, larry, benjamin.peterson, mpm, marmoute
2015-04-17 00:06:55josh.rsetmessageid: <>
2015-04-17 00:06:55josh.rlinkissue23971 messages
2015-04-17 00:06:55josh.rcreate