[Python-checkins] bpo-33234: Add exact allocation optimization to lists in What's New (GH-10200)

Pablo Galindo webhook-mailer at python.org
Sun Oct 28 18:03:23 EDT 2018


https://github.com/python/cpython/commit/c61e229d2a4c54ffb4153e1f0f48126ba33c9cbf
commit: c61e229d2a4c54ffb4153e1f0f48126ba33c9cbf
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018-10-28T22:03:18Z
summary:

bpo-33234: Add exact allocation optimization to lists in What's New (GH-10200)

In commit 372d705 a new optimization to the list() type was introduced but it was not added
to the optimization section in What's new for Python 3.8.

files:
M Doc/whatsnew/3.8.rst

diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 05b7d235cee8..758d32e6e55a 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -242,6 +242,11 @@ Optimizations
   Note that this means that instances can no longer be weak-referenced and
   that arbitrary attributes can no longer be added to them.
 
+* The :class:`list` constructor does not overallocate the internal item buffer
+  if the input iterable has a known length (the input implements ``__len__``).
+  This makes the created list 12% smaller on average. (Contributed by Pablo
+  Galindo in :issue:`33234`.)
+
 
 Build and C API Changes
 =======================



More information about the Python-checkins mailing list