Is there a way to clear the value of a variable in python?
For example if I was implementing a binary tree:
Class Node: self.left = somenode1
The del keyword would do.
del
>>> a=1 >>> a 1 >>> del a >>> a Traceback (most recent call last): File "", line 1, in NameError: name 'a' is not defined
But in this case I vote for self.left = None
self.left = None