Should I start converting/removing uses of the types module where possible?
Go ahead, but don't be too aggressive. I.e. leave cases where it's unclear what to do alone, and don't strive for completeness. OTOH, I see no need to go through the SF patch manager for this, as long as the test suite runs.
So where we have: assert type(lineno) is types.IntType assert type(lineno) in (types.IntType, types.LongType)
would become: assert type(lineno) is int assert type(lineno) in (int, long)
or assert isinstance(lineno, int) assert isinstance(lineno, (int, long))
Preferences?
I strongly prefer the isinstance() forms, but beware that they have different semantics in the light of subtypes. You may have to think about what's intended. Usually isinstance() will be the right thing to do though. --Guido van Rossum (home page: http://www.python.org/~guido/)