help on ultra newbie program please

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Thu May 22 22:30:26 EDT 2003


Andrew Walkingshaw wrote:
> def dbrent(f, df, ax, bx, cx, tol = 0.001, maxiter = 100,
>            zeps=1e-10, fuzz=1e-10):
>     """ Brent line search using derivatives. """
> 
>     a = b = d = d1 = d2 = du = dv = dx = dw = e = 0.0
> 
> it seemed useful to me, optically,
> to list what the temporary variables *were* in this function "up front".

It's perfectly commendable to document such things for
the benefit of the human reader. But in this case I
think it would be better to just use a comment, which
would avoid giving the impression that these variables
need to be initialised for some reason.

It would also give you the opportunity to make some
comments about what the variables are used for, which
would be even better.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list