From 3a98ddd136275ef944aa4387c964fc0c5adf6fab Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 7 Jul 2018 16:32:57 -0700 Subject: bpo-33888: Use CPython instead of Python in the FAQ (GH-7767) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the change where discussing the CPython implementation of lists and dicts. (cherry picked from commit 8d41278045ee4e8bf1cadb58a7db58d70ad55237) Co-authored-by: Andrés Delfino --- Doc/faq/design.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index 00ff1d1..285c7f1 100644 --- a/Doc/faq/design.rst +++ b/Doc/faq/design.rst @@ -503,10 +503,10 @@ you can always change a list's elements. Only immutable elements can be used as dictionary keys, and hence only tuples and not lists can be used as keys. -How are lists implemented? --------------------------- +How are lists implemented in CPython? +------------------------------------- -Python's lists are really variable-length arrays, not Lisp-style linked lists. +CPython's lists are really variable-length arrays, not Lisp-style linked lists. The implementation uses a contiguous array of references to other objects, and keeps a pointer to this array and the array's length in a list head structure. @@ -519,10 +519,10 @@ when the array must be grown, some extra space is allocated so the next few times don't require an actual resize. -How are dictionaries implemented? ---------------------------------- +How are dictionaries implemented in CPython? +-------------------------------------------- -Python's dictionaries are implemented as resizable hash tables. Compared to +CPython's dictionaries are implemented as resizable hash tables. Compared to B-trees, this gives better performance for lookup (the most common operation by far) under most circumstances, and the implementation is simpler. -- cgit v0.12