[IronPython] Old print syntax as option on IronPython 3

Dino Viehland dinov at microsoft.com
Tue Apr 12 18:54:57 CEST 2011


This already exists in 2.x because you can do from __future__ import print_function (which gives you the 2.x behavior on 3.x).  The tokenizer just stops yielding out print as a keyword when that's used and instead always returns a name token.  I would guess that CPython does something similar in their 2.x branch.

Personally I would suggest first getting this change into CPython 3.x if you really thought it was valuable (maybe a from past import print_statement).  I don't think it would be that helpful in translating scripts if IronPython was the only one to have it.  Plus print as a function is probably one of the easiest things to move over to and I'm guessing 2to3 translates it w/o any issues.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Markus Schaber
Sent: Tuesday, April 12, 2011 1:12 AM
To: users at lists.ironpython.com
Subject: [IronPython] Old print syntax as option on IronPython 3

Hi,

I just saw that Boo supports both print as a function and as a statement.

So I had the Idea of adding an language option to IronPython which allows both syntaxes (and probably emitting a warning when using the old one). This could help in the transition of old scripts to IronPython 3.

I know that the cPython parser does not allow that (using the same word as keyword and identifier), but maybe the IronPython parser is flexible enough to allow both usages?

Just a weird, heretical suggestion, feel free to ignore my mail. :)

Regards,
Markus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110412/15782c77/attachment.html>


More information about the Ironpython-users mailing list