Johnny Blonde wrote: > Hello Group! > > I really tried hard for two hours to rewrite the following expression > (python 2.4): > -------------------------- > teilnehmer = [] > for r in Reisen.select(AND(Reisen.q.RESVON <= datum, Reisen.q.RESBIS >> = datum)): > for g in r.BUCHUNGEN: > for t in g.aktiveTeilnehmer: > teilnehmer.append(t) > -------------------------- > > to something like > -------------------------- > teilnehmer = [x for x in ........] > -------------------------- > > Reisen is a SQLObject class, Reisen.select(...), aktiveTeilnehmer and > BUCHUNGEN all are of the type SelectResults. > > unfortunately i just canĀ“t figure it out to make it work. > i hope someone maybe can help me? > > I hope to gain performance by rewriting it... > > Thanks a lot for your help! > >>> lt = [[[1,2,3], [2,3,4]], [[3,4,5], [4,5,6]]] >>> lf = [c for a in lt for b in a for c in b] >>> lf [1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6] >>>
Untested: teilnehmer = [t for r in Reisen.select(AND(Reisen.q.RESVON <= datum, reisen.q.RESBIS >= datum)) for g in r.BUCHUNGEN for t in g.aktiveTeilnehmer] regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Recent Ramblings http://holdenweb.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list