[Biopython-dev] Python 3 porting

Peter biopython at maubp.freeserve.co.uk
Tue Jul 6 14:03:05 UTC 2010


2010/7/6 Tiago Antão <tiagoantao at gmail.com>:
>
> On Tue, Jul 6, 2010 at 11:03 AM, Peter <biopython at maubp.freeserve.co.uk> wrote:
>> This also requires a sprinkling of decode/encode calls in SffIO.py when reading/
>> writing the binary file - I'm not sure how to get that automatically with 2to3.
>
> Would it be problematic if the 2.x code had that? 2.6 at least
> supports decode/encode. Of course I do not know the implications in
> code that is highly string intensive like SeqIO stuff... but it other
> places (test cases, very simple) it seems to work OK.

Python 2.4+ strings and unicode objects do support encode and decode,
but we don't want to be converting from strings to unicode on Python 2.x -
I want everything to stay as plain strings. Adding explicit decode calls
would have side effects on Python 2.x (things becoming unicode), but
would be needed for SFF parsing on Python 3.

I could add explicit encode calls which would help SFF output under
Python 3.x. This shouldn't change the functionality on Python 2.x, but
I am a little concerned about it having a negative impact on the speed,
but I have not measured this.

We may need some big if statements...

Peter




More information about the Biopython-dev mailing list