Debugging decorator

Chris Angelico rosuav at gmail.com
Sun Nov 3 08:22:08 EST 2013


On Mon, Nov 4, 2013 at 12:20 AM, Chris Angelico <rosuav at gmail.com> wrote:
> As print is now a function, you're going to need to construct a
> function call element instead of a special 'print' node. I don't know
> how to do that as I'm not an AST expert, but hopefully you can work it
> out from there?
>
> If you need it to be cross-version, you could probably use
> sys.stdout.write explicitly (not forgetting to add a newline, which
> print does and write - obviously - doesn't). Or just demand that "from
> __future__ import print_function" be used, which will make 2.7 like
> 3.3.

Oh, I just noticed that the person using 2to3 wasn't the OP. My
apologies, my language was aimed at the decorator's primary developer.
Yasar, are you prepared to take on Python 3 support fully? If it's as
simple as tweaking the Print nodes, that shouldn't be too hard (I
hope).

ChrisA



More information about the Python-list mailing list