of course the more correct way is most likely the use of short circuit evaluation. so somthing along lines of if (len(item) > 0) and (item[0] == '-'): pass would probably be the correct approach.