summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeador Inge <meadori@gmail.com>2012-01-19 06:17:44 (GMT)
committerMeador Inge <meadori@gmail.com>2012-01-19 06:17:44 (GMT)
commitda747c3d977d2c90e9877be7264adf7516bbf599 (patch)
treebe96d20d24ab2c05e5ed68da0363738f847e32a2
parentd7664dee0c35c01e71fc0ea65d0b7547dfb0212a (diff)
downloadcpython-da747c3d977d2c90e9877be7264adf7516bbf599.zip
cpython-da747c3d977d2c90e9877be7264adf7516bbf599.tar.gz
cpython-da747c3d977d2c90e9877be7264adf7516bbf599.tar.bz2
Issue #2134: Clarify token.OP handling rationale in tokenize documentation.
-rw-r--r--Doc/library/tokenize.rst6
-rw-r--r--Misc/NEWS3
2 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst
index 30677ea..7075035 100644
--- a/Doc/library/tokenize.rst
+++ b/Doc/library/tokenize.rst
@@ -15,6 +15,12 @@ implemented in Python. The scanner in this module returns comments as tokens as
well, making it useful for implementing "pretty-printers," including colorizers
for on-screen displays.
+To simplify token stream handling, all :ref:`operators` and :ref:`delimiters`
+tokens are returned using the generic :data:`token.OP` token type. The exact
+type can be determined by checking the token ``string`` field on the
+:term:`named tuple` returned from :func:`tokenize.tokenize` for the character
+sequence that identifies a specific operator token.
+
The primary entry point is a :term:`generator`:
.. function:: generate_tokens(readline)
diff --git a/Misc/NEWS b/Misc/NEWS
index 0233823..2193af0 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -495,6 +495,9 @@ Tests
Documentation
-------------
+- Issue #2134: The tokenize documentation has been clarified to explain why
+ all operator and delimiter tokens are treated as token.OP tokens.
+
- Issue #13513: Fix io.IOBase documentation to correctly link to the
io.IOBase.readline method instead of the readline module.