Peter wrote: >> But this can be expensive memory wise. Is there a way to concatenate >> generator expressions? > > itertools.chain() >
Aha! import itertools >>> x = itertools.chain( (x for x in [None,None] if x is not None), [ None ] >>> ).next() >>> print x None >>> x = itertools.chain( (x for x in [None,7] if x is not None), [ None ] >>> ).next() >>> print x 7 >>> W -- http://mail.python.org/mailman/listinfo/python-list