On Sat, Jan 3, 2009 at 05:15, Kent Johnson <ken...@tds.net> wrote:
> On Fri, Jan 2, 2009 at 6:12 PM, Sander Sweers <sander.swe...@gmail.com> wrote:
>> not understand how  operator.itemgetter(1) works.
>
> See
> http://personalpages.tds.net/~kent37/kk/00007.html#e7the-operator-module

Ok, if I understand this correctly counts.iteritems() creates a tuple
(name, count) and this is passed to operator.itemgetter() which take
the second value to sort the list.

Previously I used a function with cmp to sort datetime.date objects
but this works way better :-)

Thanks
Sander
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to