It's not possible, because integers are immutable, while list are mutable.

In b = a[1] you are actually assigning a new value to b

Demo:

>>> a = 2
>>> id(a)
38666560
>>> a += 2
>>> id(a)
38666512

You can like this,

>>> a = [1,2,3]
>>> b = a
>>> a[1] = 3
>>> b
[1, 3, 3]
>>> a
[1, 3, 3]
>>> id(a)
140554771954576
>>> id(b)
140554771954576

You can read this document.

Answer from Adem Öztaş on Stack Overflow
🌐
Programiz
programiz.com › python-programming › methods › list › index
Python List index() (with Code Visualization)
models = ['Claude', 'ChatGPT', 'Gemini', 'ChatGPT'] # Search 'ChatGPT' from start to end index = models.index('ChatGPT') print(index) # Output: 1 # Search 'ChatGPT' from index 2 to end index = models.index('ChatGPT', 2) print(index) # Output: 3 # Search 'ChatGPT' from index 2 to index 3 (exclusive) index = models.index('ChatGPT', 2, 3) print(index) # ValueError: 'ChatGPT' is not in list · Note: Python also supports negative indexing and you can use negative start and end indices with index().
🌐
W3Schools
w3schools.com › python › ref_list_index.asp
Python List index() Method
Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... The index() method returns the position at the first occurrence of the specified value.
Discussions

python - How can I get the reference of a List element? - Stack Overflow
You can't assign a reference from a variable to a list position. Unlike C++, in Python this is not possible. The closest you can go is to create an anonymous function to reference that single list index, and assign a new value to it: More on stackoverflow.com
🌐 stackoverflow.com
python - Using an index to get an item - Stack Overflow
I have a list in python ('A','B','C','D','E'), how do I get which item is under a particular index number? Example: Say it was given 0, it would return A. Given 2, it would return C. Given 4, it w... More on stackoverflow.com
🌐 stackoverflow.com
python - Use a list of item and list of indices as a reference to index other lists - Stack Overflow
If I have two lists, one with all possible items and one with indices for those items. For instance lets say The first list is all the 26 alphabet and the other list is sequence of 26 numbers from ... More on stackoverflow.com
🌐 stackoverflow.com
Reference items in a list by reference instead of index?
I've got an algorithm that does this Your algorithm? More on reddit.com
🌐 r/learnpython
7
3
July 13, 2024
🌐
DataCamp
datacamp.com › tutorial › python-list-index
Python List index() Method Explained with Examples | DataCamp
March 28, 2025 - If the value is not found in the sequence, the function raises a ValueError. For example, if we have a list [1, 2, 3, 4, 5], we can find the index of the value 3 by calling list.index(3), which will return the value 2 (since 3 is the third element in the list, and indexing starts at 0).
🌐
Codecademy
codecademy.com › learn › introduction-to-python-for-finance › modules › learn-python3-lists › cheatsheet
Introduction to Python: Lists Cheatsheet | Codecademy
To access a list element by index, square bracket notation is used: list[index]. ... Negative indices for lists in Python can be used to reference elements in relation to the end of a list.
🌐
Python Reference
python-reference.readthedocs.io › en › latest › docs › list › lindex.html
index — Python Reference (The Right Way) 0.1 documentation
Required. Any valid type. ValueError is raised if item is not in the list. ... >>> [1, 2, 3].index(2) 1 >>> [1, 2, 3].index('foo') Traceback (most recent call last): File "<interactive input>", line 1, in <module> ValueError: 'foo' is not in list
🌐
CodeRivers
coderivers.org › blog › how-to-reference-an-element-in-a-list-python
Python Lists: How to Reference Elements - CodeRivers
August 8, 2026 - Each element in the list has an associated index, which is used to access that element. The indexes in Python start from 0 for positive indexing. For example, in a list my_list = [10, 20, 30, 40], the element 10 has an index of 0, 20 has an index of 1, and so on.
Find elsewhere
🌐
Skill Matrix Academy
skillsmatrixacademy.com › home › python list index() method explained with practical examples
Python list index() Method Explained with Practical Examples
November 7, 2025 - The index() function also works perfectly with Python strings. Since a string is like a list of characters, you can search for characters or even substrings. ... This shows the first position of “g” in the string “programming”. If the element you’re looking for doesn’t exist, Python raises a ValueError. You can avoid this by using a simple check before searching: colours = [“red”, “green”, “blue”] if “yellow” in colours: print(colors.index(“yellow”)) else: print(“Element not found!”) This is a clean way to prevent errors during your Python list operations.
🌐
W3Schools
w3schools.com › python › python_lists_access.asp
Python - Access List Items
List items are indexed and you can access them by referring to the index number.
🌐
GeeksforGeeks
geeksforgeeks.org › python-list-index
Python List index() - Find Index of Item - GeeksforGeeks
This method modifies the original list by appending all items from the given iterable. Using extend() method is easy and efficient way to merge two lists or add multiple elements at once.Let’s look at a simple · 2 min read Python List index() - Find Index of Item
Published: April 27, 2025
🌐
Stack Overflow
stackoverflow.com › questions › 71544194 › use-a-list-of-item-and-list-of-indices-as-a-reference-to-index-other-lists
python - Use a list of item and list of indices as a reference to index other lists - Stack Overflow
Given : l = ["A", "A", "Q", "K"] Output: lx = [100, 100, 1700, 1100] ... Given : l = ["E", "R", "I", "N", "W", "A", "L", "T", "E", "R'] Output: lx = [500, 1800, 900, 1400, 2300, 100, 1200, 2000, 500, 1800] ... lx = [idx[alpha.index(i)] for i ...
🌐
CodeGenes
codegenes.net › blog › how-to-reference-an-element-in-a-list-python
Mastering Element Referencing in Python Lists — codegenes.net
Indexing is the most basic way to reference an element in a list. You can use square brackets [] after the list name, followed by the index of the element you want to access. # Create a list my_list = [10, 20, 30, 40, 50] # Access the first ...
🌐
Simplilearn
simplilearn.com › home › resources › software development › python index: mastering list indexing techniques
Python List index() Method Explained with Examples
August 3, 2026 - The Python index() method helps you find the index position of an element or an item in a string of characters or a list of items.
Address: 5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Tutorialspoint
tutorialspoint.com › python › python_lists.htm
Python - Lists
A Python list is mutable. Any item from the list can be accessed using its index, and can be modified. One or more objects from the list can be removed or added. A list may have same item at more than one index positions. To access values in lists, use the square brackets for slicing along with the index or indices to obtain value available at that index. For example −
🌐
Open Book Project
openbookproject.net › thinkcs › python › english3e › lists.html
11. Lists — How to Think Like a Computer Scientist: Learning with Python 3
This pattern is common enough that Python provides a nicer way to implement it: enumerate generates pairs of both (index, value) during the list traversal. Try this next example to see more clearly how enumerate works: ... Passing a list as an argument actually passes a reference to the list, not a copy or clone of the list.
🌐
W3schools
w3schools.dev › python › ref_list_index.asp
Python List index() Method - W3Schools
Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Server Python Interview Q&A Python Bootcamp Python Certificate ... The index() method returns the position at the first occurrence of the specified value.
🌐
freeCodeCamp
freecodecamp.org › news › python-find-in-list-how-to-find-the-index-of-an-item-or-element-in-a-list
Python Find in List – How to Find the Index of an Item or Element in a List
February 24, 2022 - In the example above, the index() method only takes one argument which is the element whose index you are looking for. Keep in mind that the argument you pass is case-sensitive. This means that if you had passed "python", and not "Python", you would have received an error as "python" with a lowercase "p" is not part of the list.
🌐
Reddit
reddit.com › r/learnpython › reference items in a list by reference instead of index?
r/learnpython on Reddit: Reference items in a list by reference instead of index?
July 13, 2024 -

This one might be a bit hard to describe, but the high-level logic is...

For a given list of random numbers (n), take the 20th value, and determine what percentage of the previous 19 numbers are below the 20th value. Repeat this for the 21st value, 22nd, etc. It will always be the previous 19 numbers.

I've got an algorithm that does this, but I need to iterate over a stupidly large amount of data. If I ran it right now, even with splitting across 6 processes, it's still going to take 2 weeks to complete. That's not practical for my purposes.

I came up with a faster algorithm, but I'm having trouble implementing it. It involves tracking merely the change in the number being compared to so that it doesn't have to iterate over all previous 19 numbers. This would scale very for what I need and should reduce the number of times I have to iterate over the data by billions.

I can almost achieve this by tracking the indexes of the items I'm looking at. The problem is that I have to insert items into the middle of this list which invalidates the index I had saved because the real value got bumped up to a higher index. If I could simply use it by reference, this wouldn't happen.

I've considered using dictionaries, but that would involve me making keys out of every number in the system down to at least 0.0001. That doesn't seem practical and I'm skeptical it would even work.

Hope I explained this well. Would appreciate any help.

🌐
Medium
medium.com › codex › what-really-happens-when-you-call-list-index-in-python-2703c5896b67
What Really Happens When You Call list.index() in Python | by Jenifar | CodeX | Medium
September 29, 2025 - That’s how the C implementation of list.index() returns the index back to your Python code in a form you can use. # A little example of reference counter import sys a = "hello" print(sys.getrefcount(a)) # includes temporary ref from getrefcount itself b = a # new reference print(sys.getrefcount(a)) # count goes up del b # reference removed print(sys.getrefcount(a)) # count goes back down