Hrvoje Nikšić added the comment:

> Can you suggest a couple of sentences you would have like to have
> seen, and where?

Thanks, I would suggest to add something like this to the documentation of 
ast.parse:

"""
``parse`` raises ``SyntaxError`` if the compiled source is invalid, and 
``ValueError`` if the source contains null bytes. Note that a successful parse 
does not guarantee correct syntax of ``source``. Further syntax errors can be 
detected, and ``SyntaxError`` raised, when the source is compiled to a code 
object using ``compile`` without the ``ast.PyCF_ONLY_AST`` flag, or executed 
with ``exec``. For example, a lone ``break`` statement can be parsed, but not 
converted into a code object or executed.
"""

I don't think the ``compile`` docs need to be changed, partly because they're 
already sizable, and partly because they don't document individual flags at 
all. (A reference to the ``ast`` module regarding the flags, like the one for 
AST objects in the first paragraph, might be a useful addition.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30637>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to