Editor

TypeError: 'list' object is not callable

What it means

You put round brackets after a list, so Python tried to call it like a function. Either a variable named list hides the built-in list() function, or you wrote items(0) when you meant items[0].

1. A variable named `list`

This raises the error

Broken
list = [3, 1, 2]
letters = list("abc")
print(letters)
Output
Traceback (most recent call last):
  File "<exec>", line 2, in <module>
TypeError: 'list' object is not callable

The fix

Fixed
numbers = [3, 1, 2]
letters = list("abc")
print(numbers, letters)
Output
[3, 1, 2] ['a', 'b', 'c']

After list = [...], the name list means your list, not the built-in function that makes lists. Giving the variable its own name keeps list() working.

Try fixing it yourself in the editor

2. Round brackets instead of square brackets

This raises the error

Broken
colors = ["red", "green", "blue"]
print(colors(0))
Output
Traceback (most recent call last):
  File "<exec>", line 2, in <module>
TypeError: 'list' object is not callable

The fix

Fixed
colors = ["red", "green", "blue"]
print(colors[0])
Output
red

Square brackets pick an item from a list. Round brackets mean "call this", and a list cannot be called.

Try fixing it yourself in the editor

When you see this error, check

  • Search your code for list = and rename that variable, for example to items or numbers.
  • In this editor, variables stay in memory between runs. After renaming, choose Restart Python in the More menu so the old list is gone.
  • Use items[0] to get an item and items[1:3] to get a slice.
  • If a function returns a list, call the function, not its result: get_items()[0], not get_items()(0).

All Python errors · How to read a traceback · Step through your code