[Python-ideas] first() and last() tests in for x in y loops

Oleg Broytman phd at phd.pp.ru
Tue Jul 20 19:19:01 CEST 2010

On Tue, Jul 20, 2010 at 12:03:07PM -0500, et gmail wrote:
> While doing "for x in y" loops I often need to know if I'm working on the
> first item or the last item in the list.


   (License: Python)

> Also it would be nice if there was an auto counter like

   Find built-in function enumerate() in the docs.

     Oleg Broytman            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-ideas mailing list