🌐
W3Schools
w3schools.com › python › ref_list_index.asp
Python List index() Method
Python Examples Python Compiler ... Plan Python Interview Q&A Python Training ... The index() method returns the position at the first occurrence of the specified value....
🌐
freeCodeCamp
freecodecamp.org › news › slicing-and-indexing-in-python
Slicing and Indexing in Python – Explained with Examples
December 11, 2025 - Indexing is the process of accessing an element in a sequence using its position in the sequence (its index). In Python, indexing starts from 0, which means the first element in a sequence is at position 0, the second element is at position ...
Discussions

Embarrassingly, i don't understand how list indexing works
Let us step back a little. Before understanding your example, try to grok the example below for i in range(0, 3): print(i) which results in: 0 1 2 And the example below my_list = [42, 6, 2024] for i in range(0, 3): print(i, my_list[i]) Which results in: 0 42 1 6 2 2024 Are those clear to ya? Thanks! More on reddit.com
🌐 r/learnpython
26
15
August 31, 2024
Curious how Python list indexing works
From what I understand about arrays, the general process to index into an array is that there is a pointer that points to the base address of the array and consequently, the desired element can be retrieved by multiplying the element index by the size of the single element. That's how C works. However, lists are data structures built into Python that also offer the same ability to index but also allow for different element types. Here we're getting into internals of the interpreter, which can differ from one interpreter to another. The CPython interpreter is written in C, so it likely uses arrays of pointers, or arrays of some sort of struct with a pointer pointing to the actual data. Pointers are the same size regardless of what they're pointing to. Jython is an interpreter written in Java, so I would guess that uses a type that is a base class for an object instance. More on reddit.com
🌐 r/learnprogramming
6
3
May 18, 2023
🌐
Railsware
railsware.com › home › engineering › indexing and slicing for lists, tuples, strings, other sequential types in python
Python Indexing and Slicing for Lists, Tuples, Strings, other Sequential Types | Railsware Blog
January 22, 2025 - As it was shown, indexing allows you to access/change/delete only a single cell of a list. What if we want to get a sublist of the list. Or we want to update a bunch of cells at once? Or we want to go on a frenzy and extend a list with an arbitrary number of new cells in any position? Those and lots of other cool tricks can be done with slice notation. Let’s look at this subject – feel free to follow along on your own editor or with an online Python compiler.
🌐
Python documentation
docs.python.org › 3 › tutorial › datastructures.html
5. Data Structures — Python 3.14.7 documentation
Though tuples may seem similar to lists, they are often used in different situations and for different purposes. Tuples are immutable, and usually contain a heterogeneous sequence of elements that are accessed via unpacking (see later in this section) or indexing (or even by attribute in the case of namedtuples).
🌐
DataCamp
datacamp.com › tutorial › python-list-index
Python List index() Method Explained with Examples | DataCamp
March 28, 2025 - In Python, indexing refers to the process of accessing a specific element in a sequence, such as a string or list, using its position or index number. Indexing in Python starts at 0, which means that the first element in a sequence has an index of 0, the second element has an index of 1, and so on.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-list-index
Python List index() - Find Index of Item - GeeksforGeeks
Interview Questions · Examples · Quizzes · DSA Python · Data Science · NumPy · Pandas · Practice · Django · Flask · Last Updated : 17 Jul, 2026 · index() method is used to find the position of an element in a list.
Published: July 17, 2026
Find elsewhere
🌐
Real Python
realpython.com › ref › glossary › indexing
indexing | Python Glossary – Real Python
In Python, indexing is an operation that allows you to access individual items within a sequence, such as a list, tuple, or string, using integer indices and the syntax sequence[index].
🌐
NumPy
numpy.org › doc › stable › user › basics.indexing.html
Indexing on ndarrays — NumPy v2.5 Manual
The simplest case of indexing with N integers returns an array scalar representing the corresponding item. As in Python, all indices are zero-based: for the i-th index \(n_i\), the valid range is \(0 \le n_i < d_i\) where \(d_i\) is the i-th element of the shape of the array.
🌐
Reddit
reddit.com › r/learnpython › embarrassingly, i don't understand how list indexing works
r/learnpython on Reddit: Embarrassingly, i don't understand how list indexing works
August 31, 2024 -

I'm learning data structure and algorithms and i came across a question in the list section. i thought after i had understood python, i had understood list but a question was asked and i find myself finding it hard to understand how the list indexing works.

here's the sample code:

arr = [1, 2, 3, 4, 5, 6]

for i in range(1, 6):

arr[i - 1] = arr[i]

for i in range(0, 6):

print(arr[i], end = " ")

it looks simple to understand but, i just can't understand it.

🌐
Mimo
mimo.org › glossary › python › index-element
Python Index: Efficient Data Retrieval and Navigation
With index Python syntax, you can retrieve or modify data by position. Python uses indices for precise referencing in loops, slicing, and updates.
🌐
Reddit
reddit.com › r/learnprogramming › curious how python list indexing works
r/learnprogramming on Reddit: Curious how Python list indexing works
May 18, 2023 -

Sorry if this question has an easy answer - I couldn't find one, but I might be using the wrong search terms.

From what I understand about arrays, the general process to index into an array is that there is a pointer that points to the base address of the array and consequently, the desired element can be retrieved by multiplying the element index by the size of the single element.

However, lists are data structures built into Python that also offer the same ability to index but also allow for different element types. So how does indexing work when the size of elements is not constant?

This also led me to believe that Python list are linked list, but searching that up revealed a couple of articles showing how to implement linked list into Python as they are not within the standard library:

https://www.geeksforgeeks.org/python-library-for-linked-list/

https://www.tutorialspoint.com/python_data_structure/python_linked_lists.htm

Top answer
1 of 3
4
From what I understand about arrays, the general process to index into an array is that there is a pointer that points to the base address of the array and consequently, the desired element can be retrieved by multiplying the element index by the size of the single element. That's how C works. However, lists are data structures built into Python that also offer the same ability to index but also allow for different element types. Here we're getting into internals of the interpreter, which can differ from one interpreter to another. The CPython interpreter is written in C, so it likely uses arrays of pointers, or arrays of some sort of struct with a pointer pointing to the actual data. Pointers are the same size regardless of what they're pointing to. Jython is an interpreter written in Java, so I would guess that uses a type that is a base class for an object instance.
2 of 3
3
It looks like CPython (the default implementation and the one you're probably using) uses dynamic arrays. https://github.com/python/cpython/blob/5c22476c01622f11b7745ee693f8b296a9d6a761/Include/listobject.h#L22 If you try to insert into an index in a list that does not yet exist, a new buffer will be allocated and all the existing values will be copied over. https://github.com/python/cpython/blob/1ca315538f2f9da6c7b86c4c46e76d454c1ec4b9/Objects/listobject.c#L290 And, as one of the other posters pointed out, these arrays are typically storing pointers for the values, which is how it deals with values of different types.
🌐
Python Like You Mean It
pythonlikeyoumeanit.com › Module3_IntroducingNumpy › BasicIndexing.html
Introducing Basic and Advanced Indexing — Python Like You Mean It
Thus far we have seen that we can access the contents of a NumPy array by specifying an integer or slice-object as an index for each one of its dimensions. Indexing into and slicing along the dimensions of an array are known as basic indexing.
🌐
Quansight-labs
quansight-labs.github.io › ndindex › indexing-guide › index.html
Guide to NumPy Indexing - ndindex documentation
These indices will not work on the built-in Python sequence types like list and str; they are only defined for NumPy arrays. This section is itself split into six subsections. First is a basic introduction to what a NumPy array is. Following this are pages for each of the remaining index types, the basic indices: tuples, ellipses, and newaxis; and the advanced indices: integer arrays and boolean arrays (i.e., masks).
🌐
Towards Data Science
towardsdatascience.com › home › latest › mastering indexing and slicing in python
Mastering Indexing and Slicing in Python | Towards Data Science
January 19, 2025 - In Python, the elements of ordered sequences like strings or lists can be -individually- accessed through their indices. This can be achieved by providing the numerical index of the element we wish to extract from the sequence.
🌐
CodeHS
codehs.com › tutorial › 13725
Tutorial: Indexing Python Strings | CodeHS
Click on one of our programs below to get started coding in the sandbox! ... Learn how to access specific items by indexing through Python strings.
🌐
Medium
medium.com › @tuenguyends › pythons-list-type-part-1-indexing-and-slicing-23ad68ca4c66
Python’s list type (part 1) — Indexing and slicing | by Tue Nguyen | Medium
April 15, 2022 - Python will try to slice as many elements as available. ... Note that slicing is different from indexing. Indexing returns an element of the list, while slicing returns a list that contain some elements of the original list, for example · # Return the first element # which is an integer x[0]1# Return a list containing only the first element x[:1][1]
🌐
Tutorialspoint
tutorialspoint.com › python › python_finding_the_index_list_item.htm
Python Finding the Index of a List Item
The index() method of list class returns the index of first occurrence of the given item. ... The index() method returns an integer, representing the index of the first occurrence of the object.
🌐
Hyperskill
hyperskill.org › university › python › indexes-and-index-in-python
Indexes and index() in Python
July 17, 2024 - In Python, an index represents the position of an element within a list. It serves as an identifier to access specific elements in a list. The concept of Python index is useful in finding the location or position of a particular element within a list. Python provides the index() function, which ...