Error checking in Python

Jiwon Seo jiwon at softwise.co.kr
Tue Jun 10 09:16:18 CEST 2003


Think of why do you care about types. You're worried about types
because you want to be sure that the arguments passed to your function
is within your expectation. So, it's not type that matters, and what
counts is whether each arguments are conforming to your expectation or
not. Type checking will cover only small amount of errors and you'll
still have argument-related errors after type checking.

You *will* get exceptions if some arguments are wrong whether the
problem is related to type, or not. So, what is the point of checking
types in a dynamic language like python? Even if you check type
yourself within some function, you will only know about it at
run-time. So you'll still have to find the source every time after you
do the type checking if you do not run it. So, there's no point. If
you do want type checking which will lessen your worries, you know
where to find it.




More information about the Python-list mailing list