demexp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Demexp-dev] Sorting tag/question lists


From: Lyu Abe
Subject: [Demexp-dev] Sorting tag/question lists
Date: Mon, 29 Oct 2007 15:12:25 +0900
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Hi,

I'm currently using this code to sort the question or tags lists...

        tag_labels = []
        for k in range(n_maxtags):
                tag_labels += s.tag_info(cookie,k*100,100)
        
        tag_labels += s.tag_info(cookie,n_maxtags*100,n_maxtags_rem)
        
        z = []
        for k in range(max_tags):
                z += [(k,tag_labels[k]['a_tag_id'])]

        z.sort(lambda x,y:cmp(x[1],y[1]))

        o = []
        for k in range(max_tags):
                o += [ tag_labels[z[k][0]] ]

        tag_labels = o


...but a voice from nowhere tells me that there must be a simpler way to do that. :P


        Thanks. Lyu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]