Purpose of Python Type Checking?

Mongryong Mongryong at sympatico.ca
Sun Jan 26 21:07:57 EST 2003


Why do people use type checking in Python?  

Yes, I know its to "ensure" that parameters are valid but doesn't that
defeat the whole purpose of one of Python's main feature? Polymorphism
and code reuse.  Who cares if a parameter is not of type(X), as long as
it has the methods and member variables necessary.  If the parameter is
missing stuff, then an exception is thrown.  

The reason I'm asking is because I don't use type checking at all but I
ses a lot of other code use it.  So, is there a good reason I should be
using it too?    









More information about the Python-list mailing list