Open In App

Internal implementation of Data Structures in Python

Python provides a variety of built-in data structures, each with its own characteristics and internal implementations optimized for specific use cases.

In this article we are going to discuss about the most commonly used Data structures in Python and a brief overview of their internal implementations:

Data Structure

Internal Implementation

Static or Dynamic

Python List

Dynamic Arrays

Dynamic

Python Tuples

Arrays

Static

Python Sets

Hash Tables

Dynamic

Python Deque

Doubly linked list

Dynamic

Python Dictionary

Hash Tables

Dynamic

Python String

Array of Unicode characters

Dynamic

Python Array

Array

Static

Python HeapQ

Binary Trees

Dynamic

Python Hash maps

Hash Functions

Dynamic

Lists:

Tuples:

Sets:

Dictionaries:

Strings:

Arrays:

Heap:

Collections from the collections module:

Hash Maps:

Graphs:

Remember that the exact internal implementation details might vary between Python versions and implementations (like CPython, Jython, IronPython, etc.). The Python language abstracts these implementation details and provides a consistent interface for developers to work with these data structures.

Article Tags :