File: //opt/alt/python37/lib/python3.7/site-packages/tempita/__pycache__/_looper.cpython-37.pyc
B
��]D � @ sR d Z ddlZddlmZ dgZG dd� de�ZG dd� de�ZG dd � d e�ZdS )
a
Helper for looping over sequences, particular in templates.
Often in a loop in a template it's handy to know what's next up,
previously up, if this is the first or last item in the sequence, etc.
These can be awkward to manage in a normal Python loop, but using the
looper you can get a better sense of the context. Use like::
>>> for loop, item in looper(['a', 'b', 'c']):
... print(loop.number, item)
... if not loop.last:
... print('---')
1 a
---
2 b
---
3 c
� N)�basestring_�looperc @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) r z�
Helper for looping (particularly in templates)
Use this like::
for loop, item in looper(seq):
if loop.first:
...
c C s
|| _ d S )N)�seq)�selfr � r �@/opt/alt/python37/lib/python3.7/site-packages/tempita/_looper.py�__init__&