[Tutor] err... list.pairs()?

Kent Johnson kent37 at tds.net
Sun Nov 2 19:53:04 CET 2008

On Sun, Nov 2, 2008 at 12:33 PM, spir <denis.spir at free.fr> wrote:
> Excuse me for such a stupid question, I just wish to stop and lose my time
> searching for something that maybe simply does not exist.
> I'm looking for the builtin function for sequences that would return a list
> of (index,item) pairs to be used in loops. analog to dict's items()
> function.

IIUC you are looking for enumerate():

The doc page on built-in functions, which contains enumerate(), is
worth skimming or reading. I also recommend the docs on built-in
types, which tell you everything you can do with a list, dict, set,
file, etc:


More information about the Tutor mailing list