Splitting a string

Patrick Maupin pmaupin at gmail.com
Sat Apr 3 23:10:20 EDT 2010


On Apr 3, 10:00 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> Tests which you know can't fail are called assertions, pre-conditions and
> post-conditions. We test them because if we don't, they will fail :)

Well, yes, but that can get rather tedious at times:

a = 1
assert 0 < a < 2
b = a + 3
assert 2 < b - a < 4
c = b * 5
assert not c % 5

At least, I usually ameliorate the pain a little bit by not bothering
to print any debugging information at the assertions until one of them
actually fails; otherwise I'd *never* get any real coding done :-)



More information about the Python-list mailing list