use map() to call object methods?
Grant Edwards
grant at nowhere.
Thu Dec 9 17:50:43 EST 1999
If I've got a list of objects "objList", all of which implement
a method named "get", and I want a list of the results of
calling that method on all of the objects, is this the best
way to do that?
getList = map(lambda x: x.get(), objList)
The alternative would be something like:
getList = []
for x in objList:
getList.append(x.get())
--
Grant Edwards grante Yow! You must be a CUB
at SCOUT!! Have you made your
visi.com MONEY-DROP today??
More information about the Python-list
mailing list