[Biopython-dev] Python 2 and 3 migration thoughts
Peter Cock
p.j.a.cock at googlemail.com
Sun Sep 8 20:52:40 UTC 2013
On Sat, Sep 7, 2013 at 8:17 PM, Eric Talevich <eric.talevich at gmail.com> wrote:
>> >
>> > # This file targets both Python 2 and Python 3 at the same time
>> > # TODO - Targets Python 2 only (use 2to3 to run under Python 3)
>> >
>>
>> Does the special comment line seem like a good solution?
>> On the plus side, it tracks any changes with the file being
>> updated (which wouldn't happen with a list in the do2to3.py
>> file).
>
> Hi Peter,
>
> This looks like a good way to move forward overall. Regarding the special
> comment lines -- since these are only used in do2to3.py, would it be
> cleaner to keep a hard-coded list of filenames in do2to3.py and leave the
> modules and scripts alone? Are there any characteristics that would make it
> difficult to determine whether a given module or script is Py3-compliant?
Hi Eric,
There are import time problems which are easy to spot - in particular
SyntaxError is a good clue. However, many of the issues are only
really found at run time (e.g. different method names). This means
that the tests (which I started with) are actually the easiest to check.
Right now I don't have a feel for what fraction of the main Bio/* and
BioSQL/* files can be made dual-coding, and that would have an
influence on how best to tag things needing 2to3 or not. I'm happy
to continue this on branches for a while longer and find out.
I do like the idea of a special #TODO comment line where 2to3
is still needed - it is symbolic of where I want the code base to go ;)
Regards,
Peter
More information about the Biopython-dev
mailing list