Are there any PEPs for typed arguments?

simonb at webone.com.au simonb at webone.com.au
Tue Dec 4 21:25:02 EST 2001


I have found these assertions help sometimes:

(1) When the data is used somewhere else to where it is made,
this means you have a tough time
working out where you goofed, since exceptions are thrown
elsewhere.
(2) when only one kind of peg goes in each kind of hole,
ie. you aren't trying to overload the holes,
which maybe happens when
(3) you are developing/prototyping/testing,
so you want it to fall over as soon as something is wrong,
which brings us back to (1).

shall i write a song ?

-simon

>
>I think that a better question is why are you adding these asserts in
>the first place?
>
>Are you claiming that "meth" would not work correctly if I passed a
>small long for "a" or that I could not use a instance that supports
>__getitem__ (that always returns a length 1 string), __len__ and a few
>other string methods for "b"?
>
>So why restrict the use of compatible types?
>
>Cheers,
>Brian
>
>




More information about the Python-list mailing list