[Python-ideas] Retain string form of AST Numbers
Chris Angelico
rosuav at gmail.com
Sat Apr 5 13:53:34 CEST 2014
On Sat, Apr 5, 2014 at 8:25 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Articles like http://time-loop.tumblr.com/post/47664644/python-ast-preserving-whitespace-and-comments
> suggest to me that we may need to start pushing people *away* from the
> ast module and add a lib2to3 inspired API specifically for lossless
> transformations based on the *actual* grammar of the running Python
> version
Ooh that looks promising. I might try to knock up a recipe for some
sort of "interactive Python in decimal mode", which would cover one of
the important cases for which people ask for decimal literals. It'd
not be perfect without some monkey-patch for int/int -> float, unless
simply every non-complex number becomes a Decimal.
Or if I don't get around to it, maybe someone else can?
ChrisA
More information about the Python-ideas
mailing list