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 rhettinger
Recipients alex, benjamin.peterson, rhettinger
Date 2013-03-02.21:48:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362260918.41.0.0284371257015.issue17338@psf.upfronthosting.co.za>
In-reply-to
Content
Guido has previously rejected any kind of user specified presizing parameter for dictionaries.  He felt that it was breaking the abstraction in a way that caused people to focus on implementation specific details.

Also, set() and dict() use presizing (and hash value reuse) only in the limited case of the input iterable being an exact dictionary or set.  Otherwise, it makes no assumptions about the input iterable and grows as needed.  For sets, even when the __len__ is known for a general iterable, we don't know how many unique elements are the input -- consider for example: set([None] * 1000000).  In typical use cases for sets, a user also doesn't know in advance how many unique elements will be present -- and to the extent they try to add estimation logic, it would only complicate their programs.
History
Date User Action Args
2013-03-02 21:48:38rhettingersetrecipients: + rhettinger, benjamin.peterson, alex
2013-03-02 21:48:38rhettingersetmessageid: <1362260918.41.0.0284371257015.issue17338@psf.upfronthosting.co.za>
2013-03-02 21:48:38rhettingerlinkissue17338 messages
2013-03-02 21:48:37rhettingercreate