We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7c34ea8 commit b2776beCopy full SHA for b2776be
1 file changed
docs/variables-expressions.rst
@@ -46,6 +46,21 @@ for the first time.
46
``y = 4``, causes ``y`` to refer to the integer object ``4``, but this does
47
not change the references of ``x`` or ``z``.
48
49
+When deleting variables using the :ref:`del <del>` statement, only the
50
+reference is deleted, not the object itself:
51
+
52
+.. code-block:: pycon
53
54
+ >>> del y
55
+ >>> print(y)
56
+ Traceback (most recent call last):
57
+ File "<python-input-10>", line 1, in <module>
58
+ print(y)
59
+ ^
60
+ NameError: name 'y' is not defined
61
+ >>> print(x, z)
62
+ 1 1
63
64
Python variables can be set to any object, whereas in many other languages
65
variables can only be stored in the declared type.
66
0 commit comments