On Sat, Apr 5, 2014 at 4:50 AM, Chris Angelico <rosuav@gmail.com> wrote:
If the Num nodes also had a .str member with the unparsed string ("1",
"2.000", and "3.0j"), it would be possible to influence their
interpretation with an AST transform - for instance, turning them into
decimal.Decimal construction calls, or wrapping them in something that
automatically keeps track of significant figures (which would mean
that "2.000" is considered more precise than a mere "2.0" or "2.").

It shouldn't be too difficult to do, and it could simply be ignored in
most cases; any sort of change to the actual number could leave the
original string out of sync with it, which isn't a problem.

Thoughts?

I like it. Apart from the AST transformation possibilities opened up, I have some AST-based style checkers that would have benefited from access to the raw numeric strings.

So as long as there's no significant adverse affect on total compilation time or space requirements, +1 from me.

Mark