Antoon Pardon wrote:
> On 2006-08-25, Simon Forman <[EMAIL PROTECTED]> wrote:
>> ...
>> Generally asserts should be used to "enforce" invariants of your code
>> (as opposed to typechecking), or to check certain things while
>> debugging.
> 
> I don't understand this argument. Can't type checking be seen as
> enforcing a code invariant?
> 
But it is practically never the "right" invariant.  You don't usually
mean type(x) == int, but rather something like x is a prime between 2
and 923.  Or 5< x**4 < 429, or _something_ problem specific.  saying
that x must be an int is almost always simultaneously too specific and
too general.

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to