Test if list contains another list
Derek Martin
code at pizzashack.org
Mon Sep 29 11:56:30 EDT 2008
On Mon, Sep 29, 2008 at 04:12:13AM -0700, bearophileHUGS at lycos.com wrote:
> Derek Martin:
> >Unless you're doing lots and lots of these in your application,<
>
> I don't agree. That's library code, so it has to be efficient and
> flexible, because it's designed to be used in many different
> situations
That's fair, but lots of folks writing Python code will look at that
and say, "What the %$#@! is this doing?!?" As I already suggested,
code that implements non-obvious algorithms ought to explain what it's
doing in comments, so that the neophyte programmers charged with
maintaining the library aren't tempted to rewrite the code so that
it's easier to understand what it's doing. It can be as simple as:
# Use Morris-Pratt algorithm to search data
Then, anyone not familiar with the algorithm can easily look it up,
and see why it was written that way.
I think it's just as important to do that in code you post on the
list, since a) the person asking the question obviously doesn't know
what you're doing, or they wouldn't have needed to ask the question,
and b) there are lots of other folks reading the list who could
benefit from the same knowledge. :)
--
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20080929/461347ae/attachment-0001.sig>
More information about the Python-list
mailing list