Why I use assertion,please check this code:
"""
class User(object):pass
class Student(User):pass
class Professional(User):pass
def add(user):
assert(user, User)
def add(users):
assert(users, (tuple, list))
#If necessary I'll also check every obj in the sequence to see whether it's
a User.
"""
I just follow some coding rules of me:
1. Controlling "input" strictly.
2. In a function keep doubting on its parameters until they're checked.
3. Let potential errors raise as early as possible.
--
http://mail.python.org/mailman/listinfo/python-list