In the other direction, e.g.,

    def expand_rle(rle):
        from itertools import repeat, chain
        return list(chain.from_iterable(repeat(x, n) for x, n in rle))

Then

>>> expand_rle([('a', 5), ('bc', 3)])
['a', 'a', 'a', 'a', 'a', 'bc', 'bc', 'bc']

As to why zip is in the distribution, but not RLE, zip is a very
widely used, general purpose, compression standard.  RLE is a
special-purpose thing.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to