diff options
Diffstat (limited to 'Doc/reference/simple_stmts.rst')
-rw-r--r-- | Doc/reference/simple_stmts.rst | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst index e9be1fd..a822006 100644 --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -143,6 +143,19 @@ Assignment of an object to a single target is recursively defined as follows. count for the object previously bound to the name to reach zero, causing the object to be deallocated and its destructor (if it has one) to be called. + .. index:: single: destructor + + The name is rebound if it was already bound. This may cause the reference count + for the object previously bound to the name to reach zero, causing the object to + be deallocated and its destructor (if it has one) to be called. + +* If the target is a target list enclosed in parentheses or in square brackets: + The object must be a sequence with the same number of items as there are targets + in the target list, and its items are assigned, from left to right, to the + corresponding targets. + + .. index:: pair: attribute; assignment + * If the target is an attribute reference: The primary expression in the reference is evaluated. It should yield an object with assignable attributes; if this is not the case, :exc:`TypeError` is raised. That object is then @@ -296,16 +309,16 @@ The extended form, ``assert expression1, expression2``, is equivalent to :: single: __debug__ exception: AssertionError -These equivalences assume that ``__debug__`` and :exc:`AssertionError` refer to +These equivalences assume that :const:`__debug__` and :exc:`AssertionError` refer to the built-in variables with those names. In the current implementation, the -built-in variable ``__debug__`` is ``True`` under normal circumstances, +built-in variable :const:`__debug__` is ``True`` under normal circumstances, ``False`` when optimization is requested (command line option -O). The current code generator emits no code for an assert statement when optimization is requested at compile time. Note that it is unnecessary to include the source code for the expression that failed in the error message; it will be displayed as part of the stack trace. -Assignments to ``__debug__`` are illegal. The value for the built-in variable +Assignments to :const:`__debug__` are illegal. The value for the built-in variable is determined when the interpreter starts. @@ -512,6 +525,7 @@ cycle of the nearest enclosing loop. .. _import: +.. _from: The :keyword:`import` statement =============================== |