[Biopython-dev] Python 2.6

Peter biopython at maubp.freeserve.co.uk
Fri Oct 3 16:52:34 UTC 2008


One of the python 2.6 issues Bruce flagged up was the deprecation of
the Sets module.  Based on a quick grep, this affects several modules:

Seq.py - used in the self test only, which could be removed
Align/AlignInfo.py
AlignIO/__init__.py - used in the self test only, which could be removed
AlignIO/PhylipIO.py
Data/CodonTable.py
Nexus/Nexus.py
Nexus/Trees.py
Restriction/Restriction.py
SeqIO/__init__.py- used in the self test only, which could be removed
SeqIO/PhylipIO.py

Most of these do either "from sets import Set" or "import sets".  On
balance I think it would make sense to convert all these to use the
new built in "set(...)" instead of "Set(...)", with a fall back for
python 2.3 like this:

#TODO - Remove this work around once we drop python 2.3 support
try:
    #Check the built in set function is present (python 2.4+)
    set = set
except NameError:
    #For python 2.3 fall back on the sets module (deprecated in python 2.6)
    from sets import Set as set

and replace all use of Set(...) with set(...) in the main code.  See
also http://www.python.org/dev/peps/pep-0218/

Of course, dropping support for python 2.3 as part of supporting 2.6
isn't out of the question, and would make dealing with the set/Set
issue much simpler.

Personally I still use python 2.3 on Windows XP because I have the
build environment all setup using MSVC 6.0, and switching python
versions would require me to setup a whole new compiler suite.  I'd
rather not drop support for python 2.3 in Biopython unless/until I've
got a Windows machine setup with a working python compatible compiler.

Peter



More information about the Biopython-dev mailing list