[portland] Need Help With a For Loop

kirby urner kirby.urner at gmail.com
Fri Mar 21 21:01:15 CET 2008


Shoot, I'm still doing something wrong.  Why don't my primary
key tuples sort the way I think they should??

Damn.

Gotta run an errand, then I'm gonna solve this!

Kirby


On Fri, Mar 21, 2008 at 12:52 PM, kirby urner <kirby.urner at gmail.com> wrote:
> OK, sorry, I was messing up:  here's the real answer.
>
>  If your SQL is able to retrieve the rows in the needed
>  order (which SQL is good at) then you don't need
>  these lines of code:
>
>     def primarykey(x):
>         return (x[3],x[2],x[1],x[5])
>
>     ranked = sorted(thelist,key=primarykey)
>
>  Keep everything else the same and I think it'll work?
>
>  Kirby


More information about the Portland mailing list