[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-17 Thread STINNER Victor
STINNER Victor added the comment: > Would it be prudent to add a Parse flag to the AST module that could provide > one of two types of AST's an optimized AST or a complete AST Adding syntax ("formatting", call it as you want) info to AST requires to add new attributes to existing AST nodes and

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-17 Thread STINNER Victor
STINNER Victor added the comment: If you consider that we are wrong, please follow the advice of starting a discussion on python-ideas. This is how Python is developed, we have a workflow. Proposing ideas on the bug tracker works in some cases, but AST is really a *core* feature of Python. You

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-17 Thread Eric V. Smith
Eric V. Smith added the comment: I agree that the proposed change would require a PEP, and this should be discussed on python-ideas. I also think there's very little chance such a change would be accepted, but that doesn't mean it's impossible. I think using a external library is your best

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread Myron Walker
New submission from Myron Walker: The 'ast' module does not indicate the type of string, ''' or '"' or '"""', that it has encountered when it parses a python document. This prevents accurate reproduction of the original parsed document by a writer walking over an instance of a abstract syntax

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread SilentGhost
Changes by SilentGhost : -- components: +Library (Lib) nosy: +benjamin.peterson, brett.cannon, georg.brandl, ncoghlan stage: -> test needed ___ Python tracker

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread Brett Cannon
Brett Cannon added the comment: Two things. One, this won't change in Python 2.7 due to compatibility, so this only applies to Python 3.6. Two, the AST has not been designed to support round-trip syntax transpiling, e.g. there is no way to get back comments in the source code. Because the

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread R. David Murray
R. David Murray added the comment: Unlike the tokenizer, I don't think the AST module makes any guarantee about being able to reproduce the original source. This might be a reasonable enhancement request, though. -- nosy: +r.david.murray ___

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread R. David Murray
R. David Murray added the comment: Please respect the decisions of the python core developers as to issue status (you can argue with us until we ask you to stop, but let us make the status change if you convince us :) We aren't rejecting your ideas, just this bug report (as not being a bug).

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread Myron Walker
Myron Walker added the comment: I am re-opening this as I believe this is an important issue for work I would like to eventually push into the python core which is python code that recode themselves as declarations or as instance representation. "I don't see any benefit in supporting this

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread Myron Walker
Myron Walker added the comment: The purpose of a syntax tree is to represent the syntax and not a final processed result of processing of syntax. The current information stored for strings is losing syntax information which seems to defeat the purpose of offering the information in a syntax

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread R. David Murray
R. David Murray added the comment: Oh, that was weird. I got a weird error message from roundup. Must have been because I was posting at the same time as Brett. I'll defer to his decision on this. -- stage: test needed -> resolved ___ Python

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread STINNER Victor
STINNER Victor added the comment: "Would adding proper storage of syntax information in the AST cause performance issues?" Exactly. And storing syntax information is useless for 90% of usages of AST. So Python is optimized for the most common cases. Again, use a different project (like

[issue25885] ast Str type does not annotate the string type when it parses a python document

2015-12-16 Thread Myron Walker
Myron Walker added the comment: Would it be prudent to add a Parse flag to the AST module that could provide one of two types of AST's an optimized AST or a complete AST -- ___ Python tracker