Commit a76bb03c authored by Sandro Tosi's avatar Sandro Tosi

None is not a keyword, link file.next() to functions.html#next

parent d6e87f43
...@@ -2372,12 +2372,12 @@ Files have the following methods: ...@@ -2372,12 +2372,12 @@ Files have the following methods:
A file object is its own iterator, for example ``iter(f)`` returns *f* (unless A file object is its own iterator, for example ``iter(f)`` returns *f* (unless
*f* is closed). When a file is used as an iterator, typically in a *f* is closed). When a file is used as an iterator, typically in a
:keyword:`for` loop (for example, ``for line in f: print line``), the :keyword:`for` loop (for example, ``for line in f: print line``), the
:meth:`.next` method is called repeatedly. This method returns the next input :meth:`next` method is called repeatedly. This method returns the next input
line, or raises :exc:`StopIteration` when EOF is hit when the file is open for line, or raises :exc:`StopIteration` when EOF is hit when the file is open for
reading (behavior is undefined when the file is open for writing). In order to reading (behavior is undefined when the file is open for writing). In order to
make a :keyword:`for` loop the most efficient way of looping over the lines of a make a :keyword:`for` loop the most efficient way of looping over the lines of a
file (a very common operation), the :meth:`next` method uses a hidden read-ahead file (a very common operation), the :meth:`next` method uses a hidden read-ahead
buffer. As a consequence of using a read-ahead buffer, combining :meth:`.next` buffer. As a consequence of using a read-ahead buffer, combining :meth:`next`
with other file methods (like :meth:`readline`) does not work right. However, with other file methods (like :meth:`readline`) does not work right. However,
using :meth:`seek` to reposition the file to an absolute position will flush the using :meth:`seek` to reposition the file to an absolute position will flush the
read-ahead buffer. read-ahead buffer.
......
...@@ -653,7 +653,7 @@ always available. ...@@ -653,7 +653,7 @@ always available.
imported. The :meth:`find_module` method is called at least with the imported. The :meth:`find_module` method is called at least with the
absolute name of the module being imported. If the module to be imported is absolute name of the module being imported. If the module to be imported is
contained in package then the parent package's :attr:`__path__` attribute contained in package then the parent package's :attr:`__path__` attribute
is passed in as a second argument. The method returns :keyword:`None` if is passed in as a second argument. The method returns ``None`` if
the module cannot be found, else returns a :term:`loader`. the module cannot be found, else returns a :term:`loader`.
:data:`sys.meta_path` is searched before any implicit default finders or :data:`sys.meta_path` is searched before any implicit default finders or
...@@ -712,7 +712,7 @@ always available. ...@@ -712,7 +712,7 @@ always available.
A dictionary acting as a cache for :term:`finder` objects. The keys are A dictionary acting as a cache for :term:`finder` objects. The keys are
paths that have been passed to :data:`sys.path_hooks` and the values are paths that have been passed to :data:`sys.path_hooks` and the values are
the finders that are found. If a path is a valid file system path but no the finders that are found. If a path is a valid file system path but no
explicit finder is found on :data:`sys.path_hooks` then :keyword:`None` is explicit finder is found on :data:`sys.path_hooks` then ``None`` is
stored to represent the implicit default finder should be used. If the path stored to represent the implicit default finder should be used. If the path
is not an existing path then :class:`imp.NullImporter` is set. is not an existing path then :class:`imp.NullImporter` is set.
......
...@@ -706,7 +706,7 @@ within a package (as denoted by the existence of a dot in the name), then a ...@@ -706,7 +706,7 @@ within a package (as denoted by the existence of a dot in the name), then a
second argument to :meth:`find_module` is given as the value of the second argument to :meth:`find_module` is given as the value of the
:attr:`__path__` attribute from the parent package (everything up to the last :attr:`__path__` attribute from the parent package (everything up to the last
dot in the name of the module being imported). If a finder can find the module dot in the name of the module being imported). If a finder can find the module
it returns a :term:`loader` (discussed later) or returns :keyword:`None`. it returns a :term:`loader` (discussed later) or returns ``None``.
.. index:: .. index::
single: sys.path_hooks single: sys.path_hooks
...@@ -733,11 +733,11 @@ finder cached then :data:`sys.path_hooks` is searched by calling each object in ...@@ -733,11 +733,11 @@ finder cached then :data:`sys.path_hooks` is searched by calling each object in
the list with a single argument of the path, returning a finder or raises the list with a single argument of the path, returning a finder or raises
:exc:`ImportError`. If a finder is returned then it is cached in :exc:`ImportError`. If a finder is returned then it is cached in
:data:`sys.path_importer_cache` and then used for that path entry. If no finder :data:`sys.path_importer_cache` and then used for that path entry. If no finder
can be found but the path exists then a value of :keyword:`None` is can be found but the path exists then a value of ``None`` is
stored in :data:`sys.path_importer_cache` to signify that an implicit, stored in :data:`sys.path_importer_cache` to signify that an implicit,
file-based finder that handles modules stored as individual files should be file-based finder that handles modules stored as individual files should be
used for that path. If the path does not exist then a finder which always used for that path. If the path does not exist then a finder which always
returns :keyword:`None` is placed in the cache for the path. returns `None`` is placed in the cache for the path.
.. index:: .. index::
single: loader single: loader
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment