2009/8/17 Simon Forman <sajmik...@gmail.com> > You can use a little helper function to create your itemgetter like this: > > def makeItemGetter(indexes): > I = itemgetter(*indexes) > if len(indexes) > 1: > return I > return lambda thing: (I(thing),) > > If indexes contains only one index the itemgetter is wrapped in a > lambda that turns its output into a tuple.
Thanks. I just thought if the stdlib could support some function like item*s *getter would be better, it always returns tuple instead of a item or a tuple of items.
-- http://mail.python.org/mailman/listinfo/python-list