Paul Rubin wrote: > Tobiah <[EMAIL PROTECTED]> writes: >> I tried doing this with a simple example, but noticed >> that [].sort(func) passes two arguments to func, whereas >> the function expected by groupby() uses only one argument. > > Use: [].sort(key=func)
Oh cool. Thanks. Only in 2.4+ it seems. >>> a = [1,2,3,4,5] >>> def sorter(thing): ... return thing % 2 == 0 ... >>> a.sort(key = sorter) >>> print a [1, 3, 5, 2, 4] >>> Nifty -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list