On Tue, Oct 7, 2008 at 5:39 PM, Terry Reedy <tjreedy@udel.e duwrote:
The ast module is indeed very different from the compiler package, as
it depends on the exact grammar definition that the interpreter is
using, rather a re-implementation (which I understand the compiler.ast
is).
My confusion starts with the fact that I'm not sure if all Python 2.4
code is going to be syntactically valid 2.6 code. I guess 2.3 is valid
2.4 is valid 2.5, which should be valid 2.6 (but not valid 3.0) - I
think it's the lockstep of 2.6 and 3.0 that's misleading me...
That sounds correct. It's annoying that I have to require Python 2.6
for this - I guess that since the compiler module is there in 2.6 I'm
not compelled to use ast until I want to run under 3.0...
--
orestis@orestis .gr
Orestis Markou wrote:
>
My impression is that the 2.6 ast package is quite different from the 2.4
compiler package, but I have not looked at it (in its 3.0 version) yet. If
the 2.4 code you are analyzing is syntactically and sematically valid as 2.6
code, which I believe is usual, then of course there is no problem. If it
is not, then I would not be sure.
>>
>Hello,
>>
>I'm the developer of PySmell ( http://github.com/orestis/pysmell ), a
>static analysis/intellisense provider for Python. I am targeting
>Python 2.4 code so I'm using the compiler package.
>>
>I've been toying around yesterday with the ast module in Python 2.6
>and it seems much more cleaner. One thing I don't understand is how
>should one handle backwards and forwards compatibility.
>Hello,
>>
>I'm the developer of PySmell ( http://github.com/orestis/pysmell ), a
>static analysis/intellisense provider for Python. I am targeting
>Python 2.4 code so I'm using the compiler package.
>>
>I've been toying around yesterday with the ast module in Python 2.6
>and it seems much more cleaner. One thing I don't understand is how
>should one handle backwards and forwards compatibility.
My impression is that the 2.6 ast package is quite different from the 2.4
compiler package, but I have not looked at it (in its 3.0 version) yet. If
the 2.4 code you are analyzing is syntactically and sematically valid as 2.6
code, which I believe is usual, then of course there is no problem. If it
is not, then I would not be sure.
it depends on the exact grammar definition that the interpreter is
using, rather a re-implementation (which I understand the compiler.ast
is).
My confusion starts with the fact that I'm not sure if all Python 2.4
code is going to be syntactically valid 2.6 code. I guess 2.3 is valid
2.4 is valid 2.5, which should be valid 2.6 (but not valid 3.0) - I
think it's the lockstep of 2.6 and 3.0 that's misleading me...
>
>
If you want to target 2.3 to 3.0, 2.6 is the only option as far as I know.
I expect you will want to run your code through 2to3 (still being improved)
and run under 3.0 to properly handle 3.0 code.
>I guess that Python 2.6 can target Python 2.3-6, and with specific
>compiler flags it can also target 3.0, so it seems that the correct
>thing to do is to use that.
>compiler flags it can also target 3.0, so it seems that the correct
>thing to do is to use that.
If you want to target 2.3 to 3.0, 2.6 is the only option as far as I know.
I expect you will want to run your code through 2to3 (still being improved)
and run under 3.0 to properly handle 3.0 code.
for this - I guess that since the compiler module is there in 2.6 I'm
not compelled to use ast until I want to run under 3.0...
>
Maybe someone else can give a better answer.
>
tjr
>
--
>
Maybe someone else can give a better answer.
>
tjr
>
--
>
--
orestis@orestis .gr
Comment