From: Raymond Hettinger on 2 Feb 2010 16:22 On Feb 2, 12:54 pm, "Alf P. Steinbach" <al...(a)start.no> wrote: > The first topic is about assertions and exceptions. I wonder whether this text > is easy or difficult to understand for a beginner. Or any improvements that > could be made. To my eyes it reads nicely. You may want to try it out on a real beginner to get their feedback. I like your section on assertions. You could add examples of other ways assertions can be used (loop invariants, sanity checks, post- condition contract checks). For example, validate a loop invariant during a selection sort. In the hypot() example, use an assertion for sanity checking by verifying an expected mathematical relationship such as the triangle inequality: assert abs(c) <= abs(a) + abs(b). The pythagorean triple example can use assertions to check post conditions: assert all(isinstance(x, int) for x in (a,b,c)) and a*a +b*b==c*c. Raymond
From: Irmen de Jong on 2 Feb 2010 19:36 On 2-2-2010 21:54, Alf P. Steinbach wrote: > I've started on ch 3 of my beginner's intro to programming, now delving > into the details of the Python language. > Alf, I think it's a good read so far. I just don't like the smilies that occur in the text. It's a book (or article) that I'm reading, not an instant messaging conversation. Irmen
|
Pages: 1 Prev: What's this vText() annotation mean? Next: PyPI source dependencies? |