On Mon, Sep 29, 2008 at 04:12:13AM -0700, [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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

Attachment: pgpsqKgyV2byd.pgp
Description: PGP signature

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to