assertions to validate function parameters

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sat Jan 27 23:36:43 EST 2007


On Sat, 27 Jan 2007 19:29:06 -0800, Carl Banks wrote:

> On Jan 27, 6:51 pm, Steven D'Aprano 
> <s... at REMOVE.THIS.cybersource.com.au> wrote:
>> On Sat, 27 Jan 2007 06:58:04 -0800, Carl Banks wrote:
>> >> I find that when I detect invalid parameters overtly, I spend less time
>> >> debugging.
>>
>> > If it helps go ahead an use them.  The world won't end if you use an
>> > assertion in a less than ideal situation.  And, after all, if someone
>> > doesn't like it they can shut them off.
>>
>> Is there any way to have finer control of assertions than just passing -O
>> to the Python interpreter? Suppose I want to switch them off for certain
>> modules but not others, am I out of luck?
> 
> Please relax.  The suggestion that one could shut them off was tongue 
> in cheek.

(a) I am relaxed;

(b) One can shut down assertions, and it isn't a joke, it is a feature;

(c) I meant my question seriously, I think it would be a good thing.


-- 
Steven.




More information about the Python-list mailing list