[Biopython-dev] GSoC code+documentation review: PhyloXML for Biopython

Eric Talevich eric.talevich at gmail.com
Sat Jul 4 16:28:45 UTC 2009


On Sat, Jul 4, 2009 at 10:14 AM, Peter <biopython at maubp.freeserve.co.uk>wrote:

>
> The __repr__ thing isn't Biopython specific, its just what Python does. For
> simple objects, eval(repr(obj)) should recreate the object. Consider:
>
> >>> print phx.other
> [Other(tag=alignment, namespace=http://example.org/align)]
>
> That is odd to me. It looks like "other" is a list, containing an "Other"
> object, but with a funny __repr__ - I would have expected it to look more
> like this:
>
> >>> print phx.other
> [Other(tag="alignment", namespace="http://example.org/align")]
>
> i.e. using the repr of what I have assumed are string arguments.
>
> Peter
>

Hi Peter,

Thanks! Your interpretation of the example is correct. I'll change __repr__
to check if the attribute is a string and, if so, escape and quote it.

In the docs, I wrote that the representation is Biopython-style because by
default, Python does something a little different for complex objects:

>>> class Foo(object): pass
>>> Foo()
<__main__.Foo object at 0xb7cff22c>

But I noticed that Seq and other Biopython objects give a nicer
representation that actually works as a constructor, so I tried to match
that.

Cheers,
Eric

(P.S. - Sorry if the original message seemed a little terse or weird. I
watched the BOSC slides and I do appreciate the effort you all put into the
conference.)



More information about the Biopython-dev mailing list