Lambda question

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jun 6 19:16:42 EDT 2011


On Mon, 06 Jun 2011 12:52:31 -0400, Terry Reedy wrote:

> Let me add something not said much here about designing functions: start
> with both a clear and succinct definition *and* test cases. (I only
> started writing tests first a year ago or so.)


For any non-trivial function, I usually start by writing the 
documentation (a docstring and doctests) first. How else do you know what 
the function is supposed to do if you don't have it documented?

By writing the documentation and examples before the code, I often 
discover that the API I first thought of was rubbish :)


-- 
Steven



More information about the Python-list mailing list