Thomas Heller <[EMAIL PROTECTED]> writes: > Jacek Generowicz <[EMAIL PROTECTED]> 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, without modification. > http://dirtsimple.org/2004/11/using-24-decorators-with-22-and-23.html 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 ? -- http://mail.python.org/mailman/listinfo/python-list