TypeError: 'list' object is not callable (Fix)
Fix the Python error TypeError: 'list' object is not callable. This page shows what the error means, the most common causes, and simple ways to correct your code.
Quick fix
numbers = [1, 2, 3]
print(numbers[0]) # correct: use square brackets for indexing
# not numbers(0)
This error usually happens when you use round brackets () on a list, or when you overwrite a built-in function name like list.
What this error means
Python is trying to call a list like a function.
A list and a function use different syntax:
- Lists use square brackets
[]for indexing - Functions use round brackets
()for calling - If a variable holds a list, writing
name()causes this error
For example:
numbers = [10, 20, 30]
print(numbers(0))
Output:
TypeError: 'list' object is not callable
Python raises the error because numbers is a list, not a function.
If you want the first item, use:
numbers = [10, 20, 30]
print(numbers[0])
Output:
10
Common cause: using () instead of []
This is the most common beginner mistake.
Use square brackets to get an item from a list:
- Use
my_list[0]to get the first item - Use
my_list[1]to get the second item my_list(0)is invalid because the list is not a function
Wrong:
fruits = ["apple", "banana", "cherry"]
print(fruits(1))
Correct:
fruits = ["apple", "banana", "cherry"]
print(fruits[1])
Output:
banana
If you need a refresher, see Python lists explained for beginners and how to create a list in Python.
Common cause: naming a variable list
Do not use list as a variable name.
Python already has a built-in function called list(). If you assign a list to the name list, you replace that built-in function in your current scope.
Wrong:
list = [1, 2, 3]
print(list("abc"))
Output:
TypeError: 'list' object is not callable
Why this happens:
list = [1, 2, 3]stores a list in the namelist- After that,
listno longer refers to the built-inlist()function - So
list("abc")tries to call a list object
Correct:
items = [1, 2, 3]
print(list("abc"))
Output:
['a', 'b', 'c']
Better variable names:
itemsnumbersvaluesnames
You can learn more about checking object types on the Python type() function explained page.
Common cause: reusing a function name for a list
You may create a function, then later assign a list to the same name.
After that, calling the name with () fails.
Wrong:
def get_numbers():
return [1, 2, 3]
get_numbers = [10, 20, 30]
print(get_numbers())
Output:
TypeError: 'list' object is not callable
Why this happens:
- At first,
get_numbersis a function - Later,
get_numbers = [10, 20, 30]replaces that function with a list - Then
get_numbers()tries to call the list
Correct:
def get_numbers():
return [1, 2, 3]
numbers = [10, 20, 30]
print(get_numbers())
print(numbers[0])
Output:
[1, 2, 3]
10
If the error started after you renamed or reassigned something, check the lines above the traceback carefully.
How to fix it
Use the fix that matches your situation:
- Replace
()with[]when accessing list items - Rename variables that shadow built-in names like
list - Rename variables that reuse function names
- Restart your interpreter or notebook if an old bad assignment still exists
Example fix for indexing:
letters = ["a", "b", "c"]
# wrong:
# print(letters(0))
# correct:
print(letters[0])
Example fix for a shadowed built-in:
values = [1, 2, 3]
print(list("hi"))
If you are working in Jupyter, IPython, or a Python shell, restarting can help after you fix the code. Old variable assignments may still be stored in memory.
Step-by-step debugging
When you see this error, use these steps:
- Read the exact line named in the traceback
- Look for a name followed by
() - Check what that name currently stores
- Use
print(type(name))if you are unsure - If the result is
<class 'list'>, do not call it with()
Useful debugging commands:
my_list = [1, 2, 3]
print(type(my_list))
print(my_list)
print(type(list))
print(dir())
Example output:
<class 'list'>
[1, 2, 3]
<class 'type'>
['__annotations__', '__builtins__', '__doc__', ...]
What these commands help you find:
print(type(my_list))shows whether a variable is a listprint(my_list)shows the actual valueprint(type(list))helps you check whetherliststill refers to the built-indir()shows names currently defined in your scope
If you want more help reading tracebacks and checking variables, see this beginner guide to debugging Python code.
How to avoid this error
A few habits can prevent this problem:
- Use clear variable names like
my_listornumbers - Do not name variables
list,str,dict, orset - Remember:
[]accesses items,()calls functions - Test small pieces of code as you write them
This is especially important in notebooks and interactive shells, where old assignments can stay around longer than you expect.
Common mistakes
These are the most common reasons for this error:
- Using
my_list(0)instead ofmy_list[0] - Assigning a list to the name
listand then callinglist() - Overwriting a function name with a list
- Keeping an old variable assignment in a notebook or interactive shell
A related error can happen with dictionaries too. See TypeError: 'dict' object is not callable.
FAQ
Why does Python say a list is not callable?
Because only functions and other callable objects can be used with (). A list cannot be called like a function.
How do I get an item from a list correctly?
Use square brackets with an index, like my_list[0].
Why did list('abc') stop working?
You probably assigned a list to the name list earlier, which replaced the built-in list() function in your current scope.
Do I need to restart Python after fixing the name?
Sometimes yes, especially in notebooks or interactive shells where the bad assignment still exists.