Dictionary : items()

Benjamin musiccomposition at gmail.com
Fri Jan 23 04:02:36 CET 2009


On Jan 22, 2:53 am, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Steven D'Aprano <ste... at REMOVE.THIS.cybersource.com.au> writes:
> > That is better written as:
> > l = sorted(abcd.items(), key=lambda x:(x[1].lower(), x[0]))
>
> In Python 2.x, I prefer the style
>
>   l = sorted(abcd.iteritems(), key=lambda (k,v): (v.lower(), k))
>
> but Python 3.0 breaks the tuple unpacking per some PEP.

PEP 3113 if you really care.




More information about the Python-list mailing list