Linked by Amjith Ramanujam on Tue 5th Aug 2008 16:48 UTC
General Development Computerworld is undertaking a series of investigations into the most widely-used programming languages. This time we chat with Guido van Rossum, best known as the author of Python, and currently working for Google, CA where he gets to spend at least half his time developing the language.
Thread beginning with comment 325834
To view parent comment, click here.
To read all comments associated with this story, please click here.
Kaali
Member since:
2005-12-22

Except that in Python, you have no way of knowing that iterableThings actually contains Things, and nothing but Things until runtime, and perhaps not even then.

This a good example, of how you in python sometimes need to compensate the lack of explicit typing by adding more tests for the sake of rubustness of the code.


That is true. You would have to create some additional logic for keeping the types explicitly "clean" if that is necessary. But is it really necessary that often?

For example, with numeric types, is it ever necessary to limit a list of objects to be of type double? With duck typing, everything that looks like a number, works like a number.

Or another common example is file-like objects in Python. If you create functions which for example count all the lines from a file: the input doesn't need to be a file, as long as it implements the methods that the line counter uses; thus implementing itself as a file-like object. And the rest falls to the exception handling system.

For before-runtime checking, there is for example PyLint.

What I'm arguing: is static typing really so much better, that you wouldn't want to use the power of dynamic typing?

Reply Parent Bookmark Score: 2