(via http://python.ie/pycon/2013/talks/cpython_objects_implementation_pearls/)
Speaker: Laurent Luce (http://twitter.com/laurentluce)
Knowing more about a programming language implementation helps to be more efficient when coding. CPython is the most-used implementation of Python, and its objects internals contain many pearls. We will cover some of the implementation pearls found in the list, dictionary, string and integer/long objects.
We will ask ourselves questions such as:
What is done internally to make the list append operation fast?
What is done to speed up key lookups in dictionaries?
what is done to optimize memory for integers/longs?
This talk will answer those questions and go over some other CPython internal pearls. I will use diagrams to clearly demonstrate the CPython concepts. We will point out differences between Python 2.x and Python 3.x.
Outline:
List object implementation pearls: - Append operation time-complexity. - Optimized sort algorithm called "timsort".
Dictionary object implementation pearls: - Resizing management. - Collision resolution.
String object implementation pearls: - Sharing small strings. - Find method algorithm.
Integer/Long object implementation pearls: - Sharing small integers/longs. - Blocks of integers.