[Biopython-dev] Bio.File
Peter Cock
p.j.a.cock at googlemail.com
Wed Oct 19 12:28:03 UTC 2011
On Wed, Oct 19, 2011 at 12:46 PM, João Rodrigues <anaryin at gmail.com> wrote:
> Hey Peter,
>
>>
>> For just the one little function, maybe not. I suspect we may want
>> more "File related" things like this for Python 3, what with text vs
>> binary handles and so on, in which case keeping Bio/File.py is
>> sensible.
>
> What kind of "things" are we talking about here? Could they be
> anticipated?
>
For instance, in Python 3 it might be useful for a parsing text
files efficiently to use binary mode (i.e. byte strings not unicode)
but also have universal newlines (which I think happens for
you automatically in Python 3 for text mode, i.e. unicode).
Surprisingly open(filename, "rbU") is accepted in Python 3,
but it acts like "rb", typical binary read mode.
>> It may be short, but duplicating this function all over the place
>> seems like a very bad idea. I think we should just be vigilant in
>> making sure it is used uniformly wherever we want to accept
>> either a handle or a filename. Perhaps some of the historically
>> handle-only parsers should start using it now?
>
> Duplicating is not a beautiful solution I must agree, but keeping
> a module and adding an import statement in every parser for
> only 5 lines isn't neither.
> I suggest we keep Bio.File, deprecating all the other functions, and
> meanwhile look at which changes we could include due to Py3.
Yes, that's what I am suggesting.
Peter
More information about the Biopython-dev
mailing list