dictionary comparison

James Stroud jstroud at mbi.ucla.edu
Thu May 5 17:32:31 EDT 2005


On Thursday 05 May 2005 01:18 pm, so sayeth Bengt Richter:
> On Thu, 5 May 2005 10:37:23 -0700, James Stroud <jstroud at mbi.ucla.edu>
> wrote: [...]
> We had the same impulse ;-)
> (see my other post in this thread)
>
> ># use patch as value and version as key
>
> ??? seems the other way around (as it should be?)

Sorry, typo in the comment.

>
> >recc_dct = dict([x.split("-") for x in recc_ary])
> >serv_dct = dict([x.split("-") for x in serv_ary])
>
> But what about multiple revs for the same patch?

My Bad...

serv_dct = dict([(a,max([z for y,z in [f.split("-") for f in serv_ary] if a==y]))
                 for a,b in [g.split("-") for g in serv_ary]])

;o)

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list