peng/functions.py
def _split_every(text, sep, count, lstrip=False, rstrip=False):
    """
    Return list of the words in the string, using count of a separator as delimiter.

    :param text: String to split
    :type  text: string

    :param sep: Separator
    :type  sep: string

    :param count: Number of separators to use as delimiter
    :type  count: integer

    :param lstrip: Flag that indicates whether whitespace is removed
                   from the beginning of each list item (True) or not
                   (False)
    :type  lstrip: boolean

    :param rstrip: Flag that indicates whether whitespace is removed
                   from the end of each list item (True) or not (False)
    :type  rstrip: boolean

    :rtype: tuple
    """
    ltr = "_rl "[2 * lstrip + rstrip].strip()
    func = lambda x: getattr(x, ltr + "strip")() if ltr != "_" else x
    items = text.split(sep)
    groups = zip_longest(*[iter(items)] * count, fillvalue="")
    joints = (sep.join(group).rstrip(sep) for group in groups)
    return tuple(func(joint) for joint in joints)
def _split_every(text, sep, count, lstrip=False, rstrip=False):
    """
    Return list of the words in the string, using count of a separator as delimiter.

    :param text: String to split
    :type  text: string

    :param sep: Separator
    :type  sep: string

    :param count: Number of separators to use as delimiter
    :type  count: integer

    :param lstrip: Flag that indicates whether whitespace is removed
                   from the beginning of each list item (True) or not
                   (False)
    :type  lstrip: boolean

    :param rstrip: Flag that indicates whether whitespace is removed
                   from the end of each list item (True) or not (False)
    :type  rstrip: boolean

    :rtype: tuple
    """
    ltr = "_rl "[2 * lstrip + rstrip].strip()
    func = lambda x: getattr(x, ltr + "strip")() if ltr != "_" else x
    items = text.split(sep)
    groups = zip_longest(*[iter(items)] * count, fillvalue="")
    joints = (sep.join(group).rstrip(sep) for group in groups)
    return tuple(func(joint) for joint in joints)
Return list of the words in the string, using count of a separator as delimiter.

    :param text: String to split
    :type  text: string

    :param sep: Separator
    :type  sep: string

    :param count: Number of separators to use as delimiter
    :type  count: integer

    :param lstrip: Flag that indicates whether whitespace is removed
                   from the beginning of each list item (True) or not
                   (False)
    :type  lstrip: boolean

    :param rstrip: Flag that indicates whether whitespace is removed
                   from the end of each list item (True) or not (False)
    :type  rstrip: boolean

    :rtype: tuple