问题 Is it possible to create a python for-loop with a modulo operation? I have a ringbuffer in Python and I want to iterate the elements between the startPos and endPos indexes, where startPos can have a bigger value than endPos . In other programming languages, I would intuitively implement this with a modulo operator: int startPos = 6; int endPos = 2; int ringBufferSize = 8; for(int i = startPos, i != endPos, i = (i+1) % ringBufferSize) { print buffer.getElementAt(i); } Is there a way to do