[Python-porting] A question about running 2to3 on projects in progress

Lennart Regebro regebro at gmail.com
Sat Mar 3 13:25:17 CET 2012


On Sat, Mar 3, 2012 at 13:21, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> Hi,
>
> Suppose a project is being ported using 2to3, and there are some parts of the
> codebase which have been converted and others which haven't. 2to3 currently
> doesn't like some 3 features when parsing, e.g. print('abc', file=sys.stdout) in
> the source causes a parse error at the '='. Is there any way around this, e.g.
> picking another grammar dynamically, or is it baked in?

Well, you have to convert only those files who haven't been converted.
Or if you mean that some things (like print) has been converted
already, you can skip those fixers.

But code that are inconsistently mixing Python 2 and Python 3 idioms
can't be converted with 2to3 as far as I know.

//Lennart


More information about the Python-porting mailing list