Re: problem with interface of operator.itemgetter

2009-08-18 Thread dou dou
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

Re: problem with interface of operator.itemgetter

2009-08-16 Thread Simon Forman
On Thu, Aug 13, 2009 at 11:16 PM, dou dounirvana...@gmail.com wrote: I have a function to do some thing like LEFT JOIN in SQL, the function use the itemgetter to get the ON and SELECT parameters of the two table(list of list), the problem is that itemgetter may return a value or a tuple of

problem with interface of operator.itemgetter

2009-08-13 Thread dou dou
I have a function to do some thing like LEFT JOIN in SQL, the function use the itemgetter to get the ON and SELECT parameters of the two table(list of list), the problem is that itemgetter may return a value or a tuple of values, because of the inconsistent return type of itemgetter, I have to do