from __future__ import decorators
jacek.generowicz at cern.ch
Thu Jan 13 08:11:45 EST 2005
Thomas Heller <theller at python.net> writes:
> Jacek Generowicz <jacek.generowicz at cern.ch> writes:
> > I have some code, which makes copious use of the @decorator syntax
> > which was introduced in Python2.4. Now I find myself in a situation
> > where I have to run the code under Python 2.3. However, I would like
> > to keep developing the code with the new syntax.
> > How could I best automate the process of making the syntax digestible
> > by Python2.3 ?
> The only way that I know of is this, although you have to rewrite your
> code somewhat:
The whole point would be to keep on developing perfectly normal
Python2.4 code, but have some means of getting it to run on 2.3,
Certainly an interesting approach. Perhaps this can be combined with a
simple textual transformation of the source code which simply replaces
@decorator with add_assignment_advisor(decorator) ... or something
along those lines.
Still, I'd prefer to find a solution on the AST level, but I guess
that's not possible without re-writing the praser.
Crazy idea ... would it be possible to shadow 2.3's parser with one
stolen from 2.4 ?
More information about the Python-list