rapid_order = True iterator = (product for product in chara) while rapid_order or not iterator.end(): product = iterator.next() if (product[2] is not None) or (product[3] is not None): rapid_order = False