[Biopython-dev] Martel

Andrew Dalke dalke at acm.org
Thu Sep 21 05:27:33 EDT 2000


Cayte:
> In a few cases, I think the names need to be more descriptive.  Variables
> like p, s or av don't give a lot of information.

I've been cleaning up the code over the last couple of days, and adding
docstring and comments.  I haven't gone through all my code yet, but
I think the case you're seeing is the sre_parse.py code.  I grabbed that
module and sre_constants.py from the 1.6 distribution.  It was written by
Fredrick Lundh and I don't have much control over it.  I have made some
changes to sre_parse.py, but I've tried to minimize those changes to make
it easier to stay in synch with future changes.

On the other hand, the sre code is being tested by a lot of people, so
there shouldn't need to be many tests for it except for the changes I've
added.  (Those changes are marked with an 'APD'.)


>  Also, the name "pattern" is used for too many things, that have different
> meanings.  The regular expression is sometimes "source" and sometimes "s".

Again, that appears to be the sre_parse code.  I have cleaned up my code
to distinguish between a regular expression in the abstract and its
representation as a "pattern" string and an "expression" tree.  My next
project is to clean up 'Generate.py' which has the regexp represented
as a tagtable.

> An example of a construct that confused me is:
>
>     x = sre_parse.parse(s, pattern = MultigroupPattern())
>    return convert_list(x.pattern, x)

I changed the 'MultigroupPattern' class name to 'GroupName'.  There's
nothing I can really do with the "pattern = " and the "x.pattern" code,
since that's the way sre_parse wants it.  I did add some documentation
beforehand saying to basically ignore the names :)

I'm giving a presentation to people tomorrow (oops! today!) about Martel.
They are chemistry people and will want to see support for MDL's file
formats.  That wasn't in the previous release so I've made a 0.25 release
which contains that format and the cleanups I've done to date.

It's at http://www.biopython.org/~dalke/Martel/Martel-0.25.tar.gz .

Also, all of the regression tests are now runnable from test/__init__.py.

Version 0.3 will be the release with the complete code cleanup (excluding
the two sre_*.py files)

                    Andrew
                    dalke at acm.org






More information about the Biopython-dev mailing list