[Biopython-dev] Post Biopython 1.62 release, clean-up after dropping Python 2.5

Lenna Peterson arklenna at gmail.com
Wed Aug 28 16:57:10 EDT 2013


On Wed, Aug 28, 2013 at 2:53 PM, Peter Cock <p.j.a.cock at googlemail.com>wrote:

>
> (2) Remove all the with statement imports (and any
> comment lines associated with them):
>
> from __future__ import with_statement
>

As I demonstrated, I regularly forget that `with` is "new"!


>
> (4) Scan over the code base looking for any comments
> about Python 2.5 (e.g. using the grep command), and
> reviewing them one by one to see if there is an old
> workaround we can now remove.
>

If I count:

    find Bio -name "*.py" -exec grep -H -n ".*#.*2\.5" {} \;

I only see 24 - not too bad. Many are `with` related.


>
> (5) More advanced code review, for example looking
> for places we can better take advantage of context
> managers (with statements) for file handles.
>

For this one:

    find Bio -name "*.py" -exec grep -H -n -P "= ?open\(" {} \;

I find 145...although not all `open()` statements can be easily swapped for
`with`.

I'm currently prepping for my UK trip so I may not be able to do any of
this before I get back mid-September.

Cheers,

Lenna


More information about the Biopython-dev mailing list