Consider using "if isinstance(i, int)".