Loading select queries into objects
Roman Suzi
rnd at onego.ru
Mon Jun 18 11:25:17 EDT 2001
On Mon, 18 Jun 2001, Graham Ashton wrote:
> In article <u3d8x295d.fsf at cs.uu.nl>, "Unknown" <piet at cs.uu.nl> wrote:
>
> > That is, if I understand how you want to do it:
> > The list of functions is [f0, f1, f2] and you want: f0(tup[0])
> > f1(tup[1])
> > f2(tup[2])
> >
> > You could do something like:
> > funlist = (self.column1, self.column2, self.some_column)
> >
> > for i in range (len(funlist)):
> > apply(funlist[i],(tup[i],))
map(lambda f, x: apply(f, (x,)), funlist, tup)
does the same, BTW.
Or even:
[apply(f, (x,)) for (f, x) in map(None, funlist, tup)]
Sincerely yours, Roman A.Suzi
--
- Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
More information about the Python-list
mailing list