TypeError: list indices must be integers

John Machin sjmachin at lexicon.net
Wed Dec 31 03:32:39 CET 2008

On Dec 31, 12:46 pm, dubux <wx1... at gmail.com> wrote:

> my head hurts from looking at it so long.

>                 mylist = map(lambda i: news_list[i], filter(lambda i: i%2 == 0, range(len(news_list))))
>                 date = mylist[y]

My head hurts from looking at that only briefly. Any good reason why
you wrote that in such a fashion instead of:
   mylist = news_list[::2]
   date = mylist[y]
or (even better):
   date = news_list[y * 2]

More information about the Python-list mailing list