[Python-checkins] cpython (2.7): The StopIteration API applies to both tokenize() and generate_tokens()

raymond.hettinger python-checkins at python.org
Mon Jul 2 05:00:22 CEST 2012


http://hg.python.org/cpython/rev/366df7ba1616
changeset:   77914:366df7ba1616
branch:      2.7
user:        Raymond Hettinger <python at rcn.com>
date:        Sun Jul 01 20:00:09 2012 -0700
summary:
  The StopIteration API applies to both tokenize() and generate_tokens()

files:
  Doc/library/tokenize.rst |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst
--- a/Doc/library/tokenize.rst
+++ b/Doc/library/tokenize.rst
@@ -29,7 +29,8 @@
    which must be a callable object which provides the same interface as the
    :meth:`readline` method of built-in file objects (see section
    :ref:`bltin-file-objects`).  Each call to the function should return one line
-   of input as a string.
+   of input as a string. Alternately, *readline* may be a callable object that
+   signals completion by raising :exc:`StopIteration`.
 
    The generator produces 5-tuples with these members: the token type; the token
    string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list