mailing list wrote:
> No-one's mentioned a Schwartzian Transform yet ; )
because it's obsoleted by the key parameter to sort...
>
>
>
> On 8/15/05, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
>>[EMAIL PROTECTED] wrote:
>>
>>>Note that in Python2.4+, you can use key= instead:
>>>
>>>def sortKey
No-one's mentioned a Schwartzian Transform yet ; )
On 8/15/05, Kent Johnson <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Note that in Python2.4+, you can use key= instead:
> >
> > def sortKey(lst):
> > return lst[2]
> > Quant.sort(key=sortKey)
> >
> > This is more effient than spe
[EMAIL PROTECTED] wrote:
> Note that in Python2.4+, you can use key= instead:
>
> def sortKey(lst):
> return lst[2]
> Quant.sort(key=sortKey)
>
> This is more effient than specifying a different comparison function, because
> the key function is only called once for each element.
And instead of
Quoting Alan G <[EMAIL PROTECTED]>:
> > Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0,
> > 0, 0 ] )
> > After Quant is created, I want to sort it by MTD. If I use a simple
> > Quant.sort(), I assume its going to sort by 'db_ticker' which is not
> > what I want.
> you need to wr
>Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0,
> 0, 0 ] )
>
> After Quant is created, I want to sort it by MTD. If I use a simple
> Quant.sort(), I assume its going to sort by 'db_ticker' which is not
> what I want.
you need to write your own comparison function.
Basicall
> >AMK has written a nice mini-tutorial on how to use a list's sort()
> >effectively:
> >
> >http://www.amk.ca/python/howto/sorting/sorting.html
> >
> >Does his tutorial make sense, or are there parts in there that are
> >baffling? Please feel free to ask questions on it, and we'll try to
>
Danny Yoo wrote:
>On Sat, 13 Aug 2005, Jim Roush wrote:
>
>
>
>>I have a python script that creates a list of lists like so:
>>
>>Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0, 0, 0 ] )
>>
>>After Quant is created, I want to sort it by MTD. If I use a simple
>>Quant.sort(),
On Sat, 13 Aug 2005, Jim Roush wrote:
> I have a python script that creates a list of lists like so:
>
> Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0, 0, 0 ] )
>
> After Quant is created, I want to sort it by MTD. If I use a simple
> Quant.sort(), I assume its going to sor