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 vstinner
Recipients pablogsal, rhettinger, serhiy.storchaka, vstinner
Date 2018-04-30.08:46:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1525077985.77.0.682650639539.issue33234@psf.upfronthosting.co.za>
In-reply-to
Content
Should we shrink the list of the length hint was way too big? For example, if the length hint was 100 but the final list of only 10. Should we shrink in that case?

I'm asking because it seems like Pablo's PR doesn't shrink the list in that case.

I wasn't sure so I checked, del shrinks the list if needed:

>>> x=list(range(1000))
>>> import sys
>>> sys.getsizeof(x)
9112
>>> del x[1:]
>>> sys.getsizeof(x)
96
History
Date User Action Args
2018-04-30 08:46:25vstinnersetrecipients: + vstinner, rhettinger, serhiy.storchaka, pablogsal
2018-04-30 08:46:25vstinnersetmessageid: <1525077985.77.0.682650639539.issue33234@psf.upfronthosting.co.za>
2018-04-30 08:46:25vstinnerlinkissue33234 messages
2018-04-30 08:46:25vstinnercreate