'Why do I keep getting the error "File "TypeError: 'int' object is not callable"? [duplicate]

Hope someone can help explain why I keep getting the following error in Python.

Python version: Python 3.10.4 OS: Windows 11 in a vm

Steps to reproduce the error in REPL or JuyterLab.

def minmax(items):
    return min(items), max(items)
lst = [98, 34, 78, 1, 0, -10, -19, -1]
(min, max) = minmax(lst) # **no error**
min, max = minmax(lst) # **error**. after this point I cannot call minmax without an error
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in minmax
TypeError: 'int' object is not callable
'int' object is not callable

(min, max) = minmax(lst) # **error**
a, b = minmax(lst) # **error**
min, max = minmax(lst) # **error**

restart REPL or restart the kernel in JypterLab will solve the problem. This kind of gives me a hint that the issue might have something to do with the Python binds the variable with an Object.

Request: Whoever takes the time to respond, please also include your thought process. For example, "I have seen this before and before of my experience I know ..." or "I read the Python doc and saw ... which led me to experiment and discover..."

I want to be able to debug these myself and want to understand the thougt process that was used to get to the answer.

What have I tried so far? -REPL to experiment -Jyputer notebook to experiment -read https://careerkarma.com/blog/python-typeerror-int-object-is-not-callable/



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source