class documentation
class LoopContext: (source)
A magic loop variable. Automatically accessible in any ``% for`` block. See the section :ref:`loop_context` for usage notes. :attr:`parent` -> :class:`.LoopContext` or ``None`` The parent loop, if one exists. :attr:`index` -> `int` The 0-based iteration count. :attr:`reverse_index` -> `int` The number of iterations remaining. :attr:`first` -> `bool` ``True`` on the first iteration, ``False`` otherwise. :attr:`last` -> `bool` ``True`` on the last iteration, ``False`` otherwise. :attr:`even` -> `bool` ``True`` when ``index`` is even. :attr:`odd` -> `bool` ``True`` when ``index`` is odd.
Method | __init__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __len__ |
Undocumented |
Method | cycle |
Cycle through values as the loop progresses. |
Instance Variable | index |
Undocumented |
Instance Variable | parent |
Undocumented |
Property | even |
Undocumented |
Property | first |
Undocumented |
Property | last |
Undocumented |
Property | odd |
Undocumented |
Property | reverse |
Undocumented |
Instance Variable | _iterable |
Undocumented |