[Biopython-dev] Python 2 and 3 migration thoughts
Peter Cock
p.j.a.cock at googlemail.com
Sun Nov 3 09:03:51 EST 2013
On Sat, Nov 2, 2013 at 6:23 PM, Eric Talevich wrote:
> On Sat, Nov 2, 2013 at 10:51 AM, Peter Cock wrote:
>> On Sat, Nov 2, 2013 at 2:39 PM, Peter Cock wrote:
>>> I take it there are no objections to me merging this work?
>>> If not, I will try to do it tomorrow (Sunday) or early next week,
Applied https://github.com/biopython/biopython/pull/250
plus a follow up fix for Python 3 on Windows,
https://github.com/biopython/biopython/commit/9a265285e587f243814ffc05772b639051b31be1
(The buildbot server is earning its keep)
>> > and move on to the final issues before we can drop 2to3
>> > (which I do not anticipate being problematic).
>>
>> They are not troublesome, perhaps worth applying soon too?
>> (Can anyone propose a more elegant solution to __nonzero__
>> versus __bool__ than to just define both?)
>>
>> This allows us to stop using 2to3 (something NumPy have
>> also managed in their recent NumPy 1.8 release), making
>> installation of Biopython from source under Python 3.3
>> faster and much simpler:
>>
>> https://github.com/peterjc/biopython/tree/py3more
>
> Cool, no objections here. Maybe after the next stable release
> we can look into finalizing and merging the new GSoC work?
Yes please.
> As far as I can tell the best way to handle __nonzero__ vs. __bool__ is what
> you indicated:
>
> class Foo(object):
> def __bool__(self): return True
> __nonzero__ = __bool__
OK, I've updated my change to use that style rather than
my initial version which literally defined it twice:
class Foo(object):
def __bool__(self): return True
def __nonzero__(self): return True
> And presumably the 2to3 converter would need to be disabled at the same
> time, or it might try to rename __nonzero__ to __bool__ and get confused.
Yes indeed. This is all done as one commit:
https://github.com/biopython/biopython/commit/d6aa77c43bf9bab6302d880ad458b46f80e21c5e
That leaves one remaining fixer, unicode, which is addressed
here https://github.com/peterjc/biopython/tree/py3more in part
by dropping Python 3.2 so that we can use unicode literals.
We deliberately didn't claim to support Python 3.2 in order to
allow us this option.
Tiago or I will need to update the buildbot server to drop
Python 3.2 before applying that change...
Regards,
Peter
More information about the Biopython-dev
mailing list