I'm trying to perform checks on the first and last elements of an interator. It has several thousand entries, so I need an expeditious method of checking. If found this post, that put me onto this strategy.
first = True
for value in iterator:
if first:
do_stuff_to_first_iter
first = False
else:
pass
do_stuff_to_last_iter
Anyone have any opinions on a quicker method of accomplishing this? Thanks a lot!