A generator form of s.split('\n') for reducing memory overhead.

    Parameters
    ----------
    s : str
        A multi-line string.

    Yields
    ------
    line : str
        A string.

def iterlines(s):
    """
    A generator form of s.split('\n') for reducing memory overhead.

    Parameters
    ----------
    s : str
        A multi-line string.

    Yields
    ------
    line : str
        A string.

    """
    prevnl = -1
    while True:
        nextnl = s.find('\n', prevnl + 1)
        if nextnl < 0:
            yield s[(prevnl+1):]
            break
        else:
            yield s[(prevnl+1):nextnl]
            prevnl = nextnl