user6764392 user6764392 - 5 months ago 26
Python Question

TypeError: 'int' object is not callable - How do I identify what is causing this error?

It would absolutely phenomenal if I could receive some input as to why am I receiving this type error. I have been debugging for hours, and I can't find anywhere what is causing this specific error within this function... :(

def a_plus_abs_b(a, b):
if b < 0:
f = sub(a, b)
f = add(a, b)
return f(a, b)


f is an int or float, not a function. You can't call it.

As you tried to call it f(a, b), you had the error:

TypeError: 'int' object is not callable

You should simply return f to avoid this.