[Baypiggies] Discussion for newbies/beginner night talks
chad.netzer at gmail.com
Sat Feb 10 02:49:59 CET 2007
On 2/9/07, Aahz <aahz at pythoncraft.com> wrote:
> On Fri, Feb 09, 2007, Chad Netzer wrote:
> > 8) Use assert() to document your code.
> First of all, assert is a statement, not a function. Second, doctests
> are much better for documenting code IMO.
Right you are! In the past I had the habit of using the parens, but
they are unpythonic.
Also, really I should have said "use assert to comment your code".
Thus if variable 'a' must be greater than 0, use this:
assert a > 0
# 'a' must be greater than zero
More information about the Baypiggies