Can’t delete a variable

I can’t delete “print”. It says “NameError: name “print” is not defined”
Repl link:

global write
write = print
del print

print is a built-in Python function not a variable.

You use del to delete objects in Python, like variables, dictionaries, etc.

Since it’s a built-in function print can’t be deleted because it is a integral part of the Python language itself.

If you want to disable the print function (?), you can override the built-in print function to do nothing or something else, like this:

def print(*args, **kwargs):
    pass  # do nothing

Here, the variable is write.
You can delete “write” by del write
As @WindLother said, you cant delete inbuilt functions


del, I believe is meant for deleting keys in a dictionary, not functions/objects/variables.

The del keyword deletes the objects. Since everything in Python is an object, therefore lists, tuples and dictionaries can also be deleted using del