Best way to check that you are at the beginning (the end) of an iterable?

Miki Tebeka miki.tebeka at
Wed Sep 7 20:24:53 EDT 2011

I guess enumerate is the best way to check for first argument. Note that if someone passes you the iterator as argument you have now way of checking if the consumed items from it.

istail can be implemented using itertools.chain, see

More information about the Python-list mailing list