0

I accidentally assigned build function name as variable in Jupyter notebook on google colab. Below an example of the code sample.

Let's say I have the following code:


sum = 0
for i in range(5):
   sum += i

Not a good idea, I know but I ran this code.

Now, I have another piece of code somewhere else, like this:


sum([1,2,3])

As soon as sum was replaced, I have this error message:

TypeError: 'int' object is not callable

Next I figured that out and restart the runtime (option on colab to reset the kernel)

My question: Is it possible to fix the build-in function without restarting the whole runtime, but using local code updates?

I mean something like:

sum = <some code to assign build-in function back>

or like:

<some tool to unassign variable>('sum')

or similar solution.

Anatoliy R
  • 1,749
  • 2
  • 14
  • 20

0 Answers0