I want a counter to keep count how many iterations in total I have done.
I do:
counter = 0;
for i, item in enumerate(items):
for j, anotheritem in enumerate(anotheritems):
counter += 1;
But I can’t help asking is there a more pythonic way?
It’s simple and readable, that’s about as Pythonic as it gets (apart from the semi-colons.)
My only advice would be to give
iandjmore descriptive names if you start putting more code into those loops.