python type_error ai_generated true

TypeError: 'int' object is not callable

ID: python/typeerror-not-callable

Also available as: JSON · Markdown
95%Fix Rate
95%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
311 active

Root Cause

Variable shadows a function name. Common: len = len(x) then calling len() again.

generic

Workarounds

  1. 95% success Find where a variable shadows the builtin/function name and rename the variable
    # Bad: list = [1,2,3]; list()  →  Fix: my_list = [1,2,3]

    Sources: https://docs.python.org/3/library/functions.html

  2. 85% success Check for missing operator: f(x)(y) might need f(x) * (y)
    f(x)(y) might need f(x) * (y)

    Sources: https://docs.python.org/3/reference/expressions.html

Dead Ends

Common approaches that don't work:

  1. Rename the function 80% fail

    The function is a builtin — you shadowed it with a variable

  2. Cast the object to callable type 75% fail

    The object is genuinely not callable — casting won't help

Error Chain

Frequently confused with: