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
Traceback (most recent call last):File "example.py", line 2, in <module>print(numbers(0))TypeError: 'list' object is not callableWhere it happened — file and lineWhat went wrong — the exception typeWhy — the detailed message
Read bottom-up: numbers is a list, so () calls it like a function; use [] to index it.

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 name list
  • After that, list no longer refers to the built-in list() 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:

  • items
  • numbers
  • values
  • names

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_numbers is 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:

  1. Read the exact line named in the traceback
  2. Look for a name followed by ()
  3. Check what that name currently stores
  4. Use print(type(name)) if you are unsure
  5. 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 list
  • print(my_list) shows the actual value
  • print(type(list)) helps you check whether list still refers to the built-in
  • dir() 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_list or numbers
  • Do not name variables list, str, dict, or set
  • 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 of my_list[0]
  • Assigning a list to the name list and then calling list()
  • 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.

See also #

Press Esc to close