๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ tutorial โ€บ datastructures.html
5. Data Structures โ€” Python 3.14.3 documentation
We saw that lists and strings have many common properties, such as indexing and slicing operations. They are two examples of sequence data types (see Sequence Types โ€” list, tuple, range). Since Python is an evolving language, other sequence data types may be added.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-data-structures
Python Data Structures - GeeksforGeeks
Tuple with the use of String: ('Geeks', 'For') Tuple using List: First element of tuple 1 Last element of tuple 6 Third last element of tuple 4 ยท Python Set is an unordered collection of data that is mutable and does not allow any duplicate element. Sets are basically used to include membership testing and eliminating duplicate entries. The data structure used in this is Hashing, a popular technique to perform insertion, deletion, and traversal in O(1) on average.
Published ย  July 23, 2025
Discussions

What is the underlying data structure for Python lists? - Stack Overflow
Actually it is most of the time. If the array doesn't have more space, it doubles it and you have to copy the array to the new one and that's O(n), so sometimes the append method isn't always O(1) 2024-10-19T01:58:00.837Z+00:00 ... The list is an inbuilt data structure in python. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Data Structures in Python - Stack Overflow
Python gives you some powerful, highly optimized data structures, both as built-ins and as part of a few modules in the standard library (lists and dicts, of course, but also tuples, sets, arrays in module array, and some other containers in module collections). More on stackoverflow.com
๐ŸŒ stackoverflow.com
What are data structures anyway?
A "data structure" is a way of organizing information (i.e.: collections of data) Real/Physical world examples: * A list where you add your friend's name and phone number and any other notes one by one as you get them. * A "Contacts" book where you add your friend's names but put them in the appropriate alphabetical section. * A "Rolodex" (or box of index cards) where each person get's their own card. * A grid of columns and rows you draw on graph paper where all names are in the same column, etc. Each of these is a different way to organize or structure the data. AKA: A different data structure. Each has advantages and disadvantages. * Some are easier to get started with (implement). Like the list. * Some are easier to find a name quickly (like the contact book) * Some are easier to add a new person in the middle (like the Rolodex/Index Cards) * Some take up more physical space and are harder to carry around (Like the Rolodex) You choose which to use based on your own criteria. Do you have a small number of people so a little list of 10 is fine? Do you have a large list of people (like 100) where a list would be unwieldly so you buy a little contacts book with alphabetic tabs on the side? Do you add and remove people frequently (like in a business) where a Rolodex is better? Do you need to take the numbers with you (like when you go on vacation) so a little book is better? Or do you only need the numbers when at your desk at work, where a big fat Rolodex is fine?? As far as the built in strings, integers, Booleans, etc.: Programmers generally call those data types, not data structures. Are they technically little data structures? Yeah, maybe. But it's not worth worrying about. Just call those data types and the bigger things data structures. More on reddit.com
๐ŸŒ r/learnpython
42
91
August 18, 2024
Common data structures that pop up in leetcode style interviews?
Common data structures https://leetcode.com/discuss/general-discussion/460599/blind-75-leetcode-questions Common patterns https://github.com/cl2333/Grokking-the-Coding-Interview-Patterns-for-Coding-Questions More on reddit.com
๐ŸŒ r/androiddev
3
7
January 2, 2023
๐ŸŒ
Real Python
realpython.com โ€บ python-data-structures
Common Python Data Structures (Guide) โ€“ Real Python
October 21, 2023 - Python lists can hold arbitrary elementsโ€”everything is an object in Python, including functions. Therefore, you can mix and match different kinds of data types and store them all in a single list. This can be a powerful feature, but the downside is that supporting multiple data types at the same time means that data is generally less tightly packed. As a result, the whole structure takes up more space:
๐ŸŒ
Edureka
edureka.co โ€บ blog โ€บ data-structures-in-python
Data Structures in Python | List, Tuple, Dict, Sets, Stack, Queue
November 27, 2024 - It is one of the most basic concepts ... which enable you to store and access data. These structures are called List, Dictionary, Tuple and Set....
๐ŸŒ
Dataquest
dataquest.io โ€บ blog โ€บ data-structures-in-python
Python Data Structures: Lists, Dictionaries, Sets, Tuples โ€“ Dataquest
May 12, 2025 - Mutable (from Latin mutabilis, "changeable") data structures are those which we can modify -- for example, by adding, removing, or changing their elements. Python has three mutable data structures: lists, dictionaries, and sets.
๐ŸŒ
Topcoder
topcoder.com โ€บ thrive โ€บ articles โ€บ python-data-structures-list-and-tuples
Python Data Structures - List and Tuples
1 2 3 < class 'list' > ['apple', 'banana', 'cherry', 'grape'] < class 'tuple' > ('apple', 'banana', 'cherry', 'grapeโ€™) ... This article will cover almost everything you need to get started with Python. Python has become one of the mo...Read More ยท Understanding data structure is a key concept to writing code in any programming language.
๐ŸŒ
Corporate Finance Institute
corporatefinanceinstitute.com โ€บ home โ€บ resources โ€บ python data structures
Python Data Structures - Overview, Types, Examples
November 23, 2023 - The basic Python data structures in Python include list, set, tuples, and dictionary. Each of the data structures is unique in its own way.
๐ŸŒ
Swaroopch
python.swaroopch.com โ€บ data_structures.html
Data Structures - A Byte of Python - SwaroopCH.com
Data structures are basically just that - they are structures which can hold some data together. In other words, they are used to store a collection of related data. There are four built-in data structures in Python - list, tuple, dictionary and set.
Find elsewhere
๐ŸŒ
Educative
educative.io โ€บ blog โ€บ 8-python-data-structures
8 common data structures in Python every programmer must know
February 16, 2021 - Python data structures are the foundation of efficient coding interviews at top companies. Python provides four built-in structures (lists, dictionaries, tuples, and sets) that serve as building blocks for more advanced structures like stacks, queues, linked lists, trees, graphs, and hash tables, ...
๐ŸŒ
Vagrant
ashki23.github.io โ€บ python-str.html
Python data structures
In this article we will learn about data types and structures in Python 3 through several examples. You may find more about Python programming at: ... for element in ['a', True, None, 123, 0.777, 8j, [1,2], (1,2), {1,2}, {'key':1}]: print(type(element)) ## <class 'str'> ## <class 'bool'> ## <class 'NoneType'> ## <class 'int'> ## <class 'float'> ## <class 'complex'> ## <class 'list'> ## <class 'tuple'> ## <class 'set'> ## <class 'dict'>
๐ŸŒ
Built In
builtin.com โ€บ data-science โ€บ python-data-structures
What Are Python Data Structures? (Definition, Examples) | Built In
The four primary built-in data structures used in Python are lists, sets, tuples and dictionaries. Lists are a type of data structure containing an ordered collection of items.
๐ŸŒ
Codecademy
codecademy.com โ€บ article โ€บ python-data-structures
A Guide to Python Data Structures | Codecademy
Letโ€™s start by discussing what data structures are in Python. ... Learn about virtualization of computer memory by building the fundamental data structures of computer science: lists, stacks, and queues.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ data-structures
Python Data Structures: Syntax, Usage, and Examples
They help programmers manage collections of data and perform operations such as searching, sorting, and modifying data. Python provides built-in data structures like lists, tuples, sets, and dictionaries, as well as more advanced structures like trees, graphs, queues, linked lists, and hash tables.
๐ŸŒ
Analytics Vidhya
analyticsvidhya.com โ€บ home โ€บ data structures in python
Data Structures in Python
April 3, 2025 - Python offers built-in data structures like lists, tuples, sets, and dictionaries, each serving unique purposes. Lists are ordered and mutable, tuples are ordered and immutable, sets are unordered collections of unique elements, and dictionaries ...
๐ŸŒ
Medium
medium.com โ€บ @techwithpraisejames โ€บ a-beginners-guide-to-mastering-python-data-structures-with-practical-examples-95befa4fb367
A Beginnerโ€™s Guide to Mastering Python Data Structures | by Praise James | Medium
April 11, 2025 - There are four built-in data structures in Python programming language namely: lists, tuples, dictionaries, and sets. But there are other user-defined data structures like graphs, trees, linked lists, hashmaps, stacks, and queues.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ inbuilt-data-structures-python
Inbuilt Data Structures in Python - GeeksforGeeks
August 8, 2022 - Python has four non-primitive inbuilt data structures namely Lists, Dictionary, Tuple and Set. These almost cover 80% of the our real world data structures.
๐ŸŒ
ScholarHat
scholarhat.com โ€บ home
Data Structures in Python - Types & Examples(A Complete Guide)
September 10, 2025 - Python data structures are collections of data elements organized and stored for efficient access and manipulation, including lists, tuples, dictionaries, sets, and arrays.
๐ŸŒ
Airbyte
airbyte.com โ€บ data integration platform โ€บ data engineering resources โ€บ 11 types of python data structures for data analysis
11 Types Of Python Data Structures For Data Analysis | Airbyte
September 2, 2025 - Python data structures, including mutable types like lists, dictionaries, and sets, and immutable types like tuples, form the backbone of efficient data analysis and engineering workflows. Key advancements in Python 3.9+ improve performance and memory management, while libraries like NumPy and Pandas extend functionality for large-scale numerical and structured data processing.
Top answer
1 of 6
25

Python gives you some powerful, highly optimized data structures, both as built-ins and as part of a few modules in the standard library (lists and dicts, of course, but also tuples, sets, arrays in module array, and some other containers in module collections).

Combinations of these data structures (and maybe some of the functions from helper modules such as heapq and bisect) are generally sufficient to implement most richer structures that may be needed in real-life programming; however, that's not invariably the case.

When you need something more than the rich library provides, consider the fact that an object's attributes (and items in collections) are essentially "pointers" to other objects (without pointer arithmetic), i.e., "reseatable references", in Python just like in Java. In Python, you normally use a None value in an attribute or item to represent what NULL would mean in C++ or null would mean in Java.

So, for example, you could implement binary trees via, e.g.:

class Node(object):

  __slots__ = 'payload', 'left', 'right'

  def __init__(self, payload=None, left=None, right=None):
    self.payload = payload
    self.left = left
    self.right = right

plus methods or functions for traversal and similar operations (the __slots__ class attribute is optional -- mostly a memory optimization, to avoid each Node instance carrying its own __dict__, which would be substantially larger than the three needed attributes/references).

Other examples of data structures that may best be represented by dedicated Python classes, rather than by direct composition of other existing Python structures, include tries (see e.g. here) and graphs (see e.g. here).

2 of 6
15

For some simple data structures (eg. a stack), you can just use the builtin list to get your job done. With more complex structures (eg. a bloom filter), you'll have to implement them yourself using the primitives the language supports.

You should use the builtins if they serve your purpose really since they're debugged and optimised by a horde of people for a long time. Doing it from scratch by yourself will probably produce an inferior data structure.

If however, you need something that's not available as a primitive or if the primitive doesn't perform well enough, you'll have to implement your own type.

The details like pointer management etc. are just implementation talk and don't really limit the capabilities of the language itself.