boolean true and false values.
Tim Rowe
digitig at cix.co.uk
Tue Jun 27 16:00:00 EDT 2000
In article <slrn8lgsjq.us.hat at se-46.wpa.wtb.tue.nl>,
hat at se-46.wpa.wtb.tue.nl (Albert Hofkamp) wrote:
The other comments have been addressed, but:
> >But that's /exactly/ right! If you execute 'total="kjerg"' then your
> >invariant is indeed violated!
>
> So, why is it then that Python allows this ?
> For a language aimed at professionals, I understand (although I wouldn't
> introduce it), but for a clean language such as Python ?
If you execute 'total = total - rand()' your invariant will probably be
broken too, in a typed language or an untyped language. No language will
stop you writing code that violates invariants! Some help you find out
that you've done it, though; Python's (and C's and C++'s) assert() helps.
Eiffel's contracts help even more. But this is not a typing issue.
More information about the Python-list
mailing list