Old print syntax as option on IronPython 3

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Old print syntax as option on IronPython 3

Markus Schaber-6

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. J

 

Regards,

Markus

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Reply | Threaded
Open this post in threaded view
|

Re: Old print syntax as option on IronPython 3

Dino Viehland

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: [hidden email] [mailto:[hidden email]] On Behalf Of Markus Schaber
Sent: Tuesday, April 12, 2011 1:12 AM
To: [hidden email]
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. J

 

Regards,

Markus

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com