Hi there, What is the simplest way to check that you are at the beginning or at the end of an iterable? I'm using enumerate with Python 3.2 (see below) but I'm wondering if there would be a better way.
l = ['a', 'b', 'a', 'c'] for pos, i in enumerate(l): if pos == 0: print("head =", i) else: print(i) I know that Python is not exactly a functional language but wouldn't something like "ishead()" or "istail()" be useful? -- http://mail.python.org/mailman/listinfo/python-list