Splitting a string
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sun Apr 4 03:37:01 EDT 2010
On Sat, 03 Apr 2010 20:10:20 -0700, Patrick Maupin wrote:
> 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
Please tell me that's just an exaggerated example for illustration
purposes, and that you don't *actually* do that!
In any case, the *right* test would be:
a = 1
assert a == 1 and a*5==5 and str(a)=='1' and [None,a,None][a] is a
*wink*
> 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 :-)
Ditto.
--
Steven
More information about the Python-list
mailing list