for lexical definition and section :ref:`naming` for documentation of naming and
binding.
-.. index:: exception: NameError
+.. index:: pair: exception; NameError
When the name is bound to an object, evaluation of the atom yields that object.
When a name is not bound, an attempt to evaluate it raises a :exc:`NameError`
Note that calling any of the generator methods below when the generator
is already executing raises a :exc:`ValueError` exception.
-.. index:: exception: StopIteration
+.. index:: pair: exception; StopIteration
.. method:: generator.__next__()
The second signature \(type\[, value\[, traceback\]\]\) is deprecated and
may be removed in a future version of Python.
-.. index:: exception: GeneratorExit
+.. index:: pair: exception; GeneratorExit
.. method:: generator.close()
which are used to control the execution of a generator function.
-.. index:: exception: StopAsyncIteration
+.. index:: pair: exception; StopAsyncIteration
.. coroutinemethod:: agen.__anext__()
The second signature \(type\[, value\[, traceback\]\]\) is deprecated and
may be removed in a future version of Python.
-.. index:: exception: GeneratorExit
+.. index:: pair: exception; GeneratorExit
.. coroutinemethod:: agen.aclose()
attributeref: `primary` "." `identifier`
.. index::
- exception: AttributeError
+ pair: exception; AttributeError
pair: object; module
pair: object; list
-.. index:: exception: TypeError
+.. index:: pair: exception; TypeError
In all three cases, if the argument does not have the proper type, a
:exc:`TypeError` exception is raised.
.. versionadded:: 3.5
.. index::
- exception: ZeroDivisionError
+ pair: exception; ZeroDivisionError
single: division
pair: operator; / (slash)
pair: operator; //
This operation can be customized using the special :meth:`__lshift__` and
:meth:`__rshift__` methods.
-.. index:: exception: ValueError
+.. index:: pair: exception; ValueError
A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A left
shift by *n* bits is defined as multiplication with ``pow(2,n)``.
.. index::
single: __debug__
- exception: AssertionError
+ pair: exception; AssertionError
These equivalences assume that :const:`__debug__` and :exc:`AssertionError` refer to
the built-in variables with those names. In the current implementation, the
single: generator; function
single: generator; iterator
single: function; generator
- exception: StopIteration
+ pair: exception; StopIteration
.. productionlist:: python-grammar
yield_stmt: `yield_expression`
pair: name; binding
pair: keyword; from
pair: keyword; as
- exception: ImportError
+ pair: exception; ImportError
single: , (comma); import statement
.. productionlist:: python-grammar
pairindextypes.pop('keyword', None)
pairindextypes.pop('operator', None)
pairindextypes.pop('object', None)
- # pairindextypes.pop('exception', None)
+ pairindextypes.pop('exception', None)
# pairindextypes.pop('statement', None)
# pairindextypes.pop('builtin', None)