user2763361 user2763361 - 2 months ago 9
Python Question

TypeError: 'float' object not callable

Why does the following generate the

TypeError: 'float' object not callable
?

sum([-450.0,950.0])

Answer

It looks like you happen to assign to a variable named sum in the same scope as the call above, thereby hiding the builtin sum function.

Comments