OpenQuizz
Une application de gestion des contenus pédagogiques
run_length Class Reference

Static Public Member Functions

def encode (iterable)
 
def decode (iterable)
 

Detailed Description

:func:`run_length.encode` compresses an iterable with run-length encoding.
It yields groups of repeated items with the count of how many times they
were repeated:

    >>> uncompressed = 'abbcccdddd'
    >>> list(run_length.encode(uncompressed))
    [('a', 1), ('b', 2), ('c', 3), ('d', 4)]

:func:`run_length.decode` decompresses an iterable that was previously
compressed with run-length encoding. It yields the items of the
decompressed iterable:

    >>> compressed = [('a', 1), ('b', 2), ('c', 3), ('d', 4)]
    >>> list(run_length.decode(compressed))
    ['a', 'b', 'b', 'c', 'c', 'c', 'd', 'd', 'd', 'd']

Member Function Documentation

◆ decode()

def decode (   iterable)
static

◆ encode()

def encode (   iterable)
static

The documentation for this class was generated from the following file: