In my code I am debating whether or not to validate the types of data
being passed to my functions.  For example

def sayHello(self, name):
    if not name:
        rasie "name can't be null"
    if not isinstance(name, str):
        raise "name must be a string"
    print "Hello " + name

Is the use of isinstance a "bad" way of doing things?  is it a "heavy"
operation?  for example, if I use this in each function validate input
will it slow things down a lot?

just curious how you might handle this type of situation (other than
not validating at all).

thanks

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to