Type checking is a bad ways to do things in Python, and if you are going to type check, at least use isinstance() over type(x) is SomeType. Likewise, iteration by index is a really bad idea.
–
LattywareApr 15 '13 at 20:15