PEP Parade

Skip Montanaro skip at pobox.com
Fri Mar 8 08:03:18 EST 2002


    Roman> Just one comment about

    Roman>   PEP 270 - uniq method for list objects

    Roman> maybe adding dict <-> list conversion functions will make this
    Roman> automatically?

Nothing new is necessary since 2.2 was released:

    >>> mylist = [1,2,3,5,6,6,9,9,1,2,3,4]
    >>> mydict = dict(zip(mylist,mylist))
    >>> mydict
    {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 9: 9}
    >>> mydict.values()
    [1, 2, 3, 4, 5, 6, 9]

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list