accept not just list or tuple, but also a generator

accept not just list or tuple, but also a generator