[Biopython-dev] Optimization of PDBParser and friends

Wibowo Arindrarto w.arindrarto at gmail.com
Tue Sep 4 12:36:55 UTC 2012

On Tue, Sep 4, 2012 at 2:16 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> On Tue, Sep 4, 2012 at 7:11 AM, Wibowo Arindrarto
> <w.arindrarto at gmail.com> wrote:
> > Hi Peter, João,
> >
> > Just a little FYI. I ran into the OrderedDict issue when I started
> > writing
> > SearchIO a few months ago as well, so I added an OrderedDict
> > implementation
> > in Bio._py3k
> >
> > (https://github.com/bow/biopython/commit/34f873b2d21136487a0b925be898c52daa0cc61c).
> >
> > The code is from the ordereddict module from PyPI at that time. I
> > haven't
> > checked if it's the same as the one shown in the link (there may have
> > been
> > some updates), but it seems to work fine up to now.
> >
> > Hope this is useful :),
> > Bow
> Given the OrderedDict will be useful for Bio.PDB and Bow's SearchIO,
> that seems quite a good case for including it. How does this look
> (on the 'od' branch in my repository)?
> https://github.com/peterjc/biopython/commit/52b011aa8ddce06e636de776d8cea8e62845853f
> This differs from Bow's version in that I put the module in as a separate
> file (Bio/_ordereddict.py), and that it will prefer the ordereddict
> package
> if already installed (e.g. from PyPI).
> Peter

Hi Peter,

This looks good. I like the 'ordereddict' module import check prior to
using our bundled version.

One more thing I would suggest is about the namespace. I feel that in
the future, we may run into similar issues (non-Python3 compatibility
issues) since Python2.7 deprecation is still a long way. Perhaps
create a new subpackage in the root folder (maybe Bio._compat, but I
don't have a strong preference), to keep code like this in one place?
Or we could even put Bio._py3k under this subpackage and have one
central place for compatibility-related code? This would prevent
further root namespace clutter.


More information about the Biopython-dev mailing list