simplify list/tuple specialisation code in for-in loop to avoid redundant type check