🔵 🔵 🔵


Primary

၊၊||၊|။

del ⚬ᵖʸ|Documentation|1st|20251021113551-00-⌔

7. Simple statements — Python 3 documentation#the-del-statement

7.5. The del statement

del_stmt: "del" target_list

Deletion is recursively defined very similar to the way assignment is defined. Rather than spelling it out in full details, here are some hints.

Deletion of a target list recursively deletes each target, from left to right.

Deletion of a name removes the binding of that name from the local or global namespace, depending on whether the name occurs in a global statement in the same code block. Trying to delete an unbound name raises a NameError exception.

Deletion of attribute references and subscriptions is passed to the primary object involved; deletion of a slicing is in general equivalent to assignment of an empty slice of the right type (but even this is determined by the sliced object).

Changed in version 3.2: Previously it was illegal to delete a name from the local namespace if it occurs as a free variable in a nested block.

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •