

def separated(items, sep=',', last=None):
    "Yield `(item, sep)` tuples, one for each element in `items`.\n\n    The separator after the last item is specified by the `last` parameter,\n    which defaults to `None`. (Since 1.1.3)\n\n    >>> list(separated([1, 2]))\n    [(1, ','), (2, None)]\n\n    >>> list(separated([1]))\n    [(1, None)]\n\n    >>> list(separated('abc', ':'))\n    [('a', ':'), ('b', ':'), ('c', None)]\n\n    >>> list(separated((1, 2, 3), sep=';', last='.'))\n    [(1, ';'), (2, ';'), (3, '.')]\n    "
    items = iter(items)
    next = items.next()
    for i in items:
        (yield (next, sep))
        next = i
    (yield (items, last))

dataset/ETHPy150Open edgewall/trac/trac/util/presentation.py separated/VarMisuse@59/289 `next`->`items`