How to Fix: TypeError: ‘int’ object is not callable

3D illustration of a robot trying to use a number block as a telephone, representing the 'int object is not callable' error.

This error is very similar to 'str' object is not callable. One common error in Python is the TypeError int not callable, which means: “You are trying to use a number as if it were a function.”

A “callable” is anything you can put parentheses () after, like print() or my_function(). An integer, like 10, is just data.

โšก Quick Fix: TypeError: ‘int’ object is not callable โ€” Python Built-in Name Overwrite Fix and Parentheses vs Brackets Syntax Error

You put () after a variable that holds an integer โ€” either you used () instead of [] to access a list item, or you overwrote a built-in function name like sum, len, or max with an integer.

# WRONG โ€” () calls a function, [] accesses a list item
my_list = [10, 20, 30]
print(my_list(0))         # TypeError: 'int' object is not callable

# WRONG โ€” 'sum' is now the integer 6, not the built-in function
my_list = [1, 2, 3]
sum = sum(my_list)        # sum is overwritten with 6
new_sum = sum([4, 5, 6])  # TypeError: 'int' object is not callable

# RIGHT โ€” [] for index access, () for function calls
print(my_list[0])         # Output: 10

# RIGHT โ€” never use built-in names as variable names
my_list = [1, 2, 3]
total = sum(my_list)      # 'sum' built-in stays intact
new_total = sum([4, 5, 6])
print(new_total)          # Output: 15

The two causes below break down each scenario โ€” including the full list of built-in names that silently overwrite Python’s core functions the moment you assign to them.

Cause 1: Using Parentheses Instead of Brackets

This is a simple syntax mistake. You meant to get an item from a list (using []), but you used parentheses () by accident.

Problem Code:

my_list = [10, 20, 30]
print(my_list(0)) # CRASH!
# You're trying to CALL the list.

The Fix: Use square brackets [] for indexing.

print(my_list[0]) # Correct! Output: 10

Cause 2: Overwriting a Function Name

This is the most common cause. You accidentally used a function name as a variable.

Problem Code:

# 'sum' is a built-in function that adds a list
my_list = [1, 2, 3]

# 1. You calculate the sum and store it in a variable...
# ... but you accidentally named it 'sum'!
sum = sum(my_list) # sum is now the number 6

# 2. You try to use the 'sum' function again
other_list = [4, 5, 6]
new_sum = sum(other_list)
# CRASH! TypeError: 'int' object (the number 6) is not callable

The Fix: NEVER use built-in function names as variable names.

my_list = [1, 2, 3]
total = sum(my_list) # Use a good variable name like 'total'

other_list = [4, 5, 6]
new_total = sum(other_list) # The 'sum' function is safe and sound.
print(new_total)

TypeError: ‘int’ object is not callable โ€” Two Causes, One Naming Rule That Prevents Both

TypeError: ‘int’ object is not callable fires the moment Python sees () after a variable that holds an integer. Python checks whether the object is callable before executing. Integers have no call() method. Python stops immediately.

Two causes generate this error. Identify yours in 30 seconds.

Parentheses where brackets belong. my_list(0) tries to call my_list as a function. my_list[0] accesses the item at index 0. The characters look similar under time pressure. If the crash line accesses a list, tuple, or string โ€” switch () to [].

A built-in function name overwritten with an integer. Python’s built-in namespace is not protected. Assign sum = 6 and Python replaces the sum() function with the integer 6 in that scope. Every subsequent call to sum() crashes with TypeError: ‘int’ object is not callable. The same applies to len, max, min, abs, round, sorted, reversed, input, print, id, type, and every other built-in.

Never use these names as variable names:

sum, len, max, min, abs, round, sorted, reversed,
input, print, id, type, list, dict, set, str, int, float

Use descriptive alternatives: total instead of sum, count instead of len, maximum instead of max. Your editor’s syntax highlighter shows built-in names in a distinct colour โ€” if the variable name you’re assigning to is highlighted as a built-in, rename it before you write the next line.

If the overwrite already happened and you need to restore the built-in within the same session:

del sum # removes the local variable, restores access to the built-in
print(sum([1, 2, 3])) # Output: 6

Similar Posts

Leave a Reply