Typing system vs. Java
ctavares at develop.com
Sat Aug 4 20:28:25 CEST 2001
"Courageous" <jkraska1 at san.rr.com> wrote in message
news:38aomtc8if8v3avgglck50ii72phtd9kaf at 4ax.com...
> >Since I can write more powerful programs in smaller, more readable
> >chunks, I think I write less buggy code. If we have to reduce the
> >simplicity/expressiveness of the language in order to add type-checking,
> >then I think the tradeoff is not worth it.
> I emphatically agree. Syntactic type declaration is considerably out of
> place with Python.
> Although I was thinking about about something which might be useful.
> What if Python were to support a type consistency check on containers?
> >>> mylist = [1,2,"alpha"]!
> Type Consistency Error:
> Note the exclamation point.
Doesn't the array module already do this?
>>> a = array.array( 'i', [1, 2, "hello world"])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: an integer is required
More information about the Python-list