Skip to content

Commit c13db97

Browse files
committed
Clarify NameError exception in 'del'
1 parent 7168e98 commit c13db97

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Doc/reference/simple_stmts.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,7 @@ Deletion of a target list recursively deletes each target, from left to right.
465465

466466
Deletion of a name removes the binding of that name from the local or global
467467
namespace, depending on whether the name occurs in a :keyword:`global` statement
468-
in the same code block. If the name is unbound, a :exc:`NameError` exception
469-
will be raised.
468+
in the same code block. Trying to delete an unbound name raises a :exc:`NameError` exception.
470469

471470
.. index:: pair: attribute; deletion
472471

Lib/pydoc_data/topics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4574,8 +4574,8 @@ def inner(x):
45744574

45754575
Deletion of a name removes the binding of that name from the local or
45764576
global namespace, depending on whether the name occurs in a "global"
4577-
statement in the same code block. If the name is unbound, a
4578-
"NameError" exception will be raised.
4577+
statement in the same code block. Trying to delete an unbound name
4578+
raises a "NameError" exception.
45794579

45804580
Deletion of attribute references, subscriptions and slicings is passed
45814581
to the primary object involved; deletion of a slicing is in general

0 commit comments

Comments
 (0)