<div class="gmail_quote">2009/8/17 Simon Forman <span dir="ltr"><<a href="mailto:sajmikins@gmail.com">sajmikins@gmail.com</a>></span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div></div></div>You can use a little helper function to create your itemgetter like this:<br><br>def makeItemGetter(indexes):<br>   I = itemgetter(*indexes)<br>   if len(indexes) > 1:<br>       return I<br>   return lambda thing: (I(thing),)<br>
<br>If indexes contains only one index the itemgetter is wrapped in a<br>lambda that turns its output into a tuple.</blockquote>
<div> </div>
<div>Thanks. I just thought if the stdlib could support some function like item<u><strong><font size="4">s</font></strong></u>getter would be better, it always returns tuple instead of a item or a tuple of items.</div>
<div> </div>
<div> </div></div><br>