for statement on empty iterable

james_027 cai.haibin at
Wed Aug 22 07:28:27 CEST 2007


I need to do some for loop on iterables which could be empty
sometimes, for example

a_list = []

for i in a_list:
 #do something

is this safe? or should I put a if statement to test it first?


More information about the Python-list mailing list