diff options
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 9 | ||||
-rw-r--r-- | Doc/reference/executionmodel.rst | 7 |
2 files changed, 9 insertions, 7 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index c13e802..7d5b7be 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1414,11 +1414,12 @@ Basic customization .. index:: single: __len__() (mapping object method) - Called to implement truth value testing, and the built-in operation ``bool()``; + Called to implement truth value testing and the built-in operation ``bool()``; should return ``False`` or ``True``, or their integer equivalents ``0`` or - ``1``. When this method is not defined, :meth:`__len__` is called, if it is - defined (see below). If a class defines neither :meth:`__len__` nor - :meth:`__nonzero__`, all its instances are considered true. + ``1``. When this method is not defined, :meth:`__len__` is called, if it is + defined, and the object is considered true if its result is nonzero. + If a class defines neither :meth:`__len__` nor :meth:`__nonzero__`, all its + instances are considered true. .. method:: object.__unicode__(self) diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst index 0d15657..05f8b92 100644 --- a/Doc/reference/executionmodel.rst +++ b/Doc/reference/executionmodel.rst @@ -87,9 +87,10 @@ subclass of :exc:`NameError`. The following constructs bind names: formal parameters to functions, :keyword:`import` statements, class and function definitions (these bind the class or function name in the defining block), and targets that are identifiers -if occurring in an assignment, :keyword:`for` loop header, or in the second -position of an :keyword:`except` clause header. The :keyword:`import` statement -of the form "``from ...import *``" binds all names defined in the imported +if occurring in an assignment, :keyword:`for` loop header, in the second +position of an :keyword:`except` clause header or after :keyword:`as` in a +:keyword:`with` statement. The :keyword:`import` statement +of the form ``from ... import *`` binds all names defined in the imported module, except those beginning with an underscore. This form may only be used at the module level. |