I would also submit there's some value in the obvious readability of
z = runlength.encode(sequence)
z = [(k, len(list(g))) for k, g in itertools.groupby(sequence)]
but that's my personal opinion. Everyone is welcome to use my code, but I probably won't submit to pypi for a two function module, it was just an idea :)
I do think it's worth adding to the docs, though, if only for future people / me googling "run length encoding python" and only finding stack overflow.
On Sat, Jun 10, 2017 at 8:46 PM, Terry Reedy email@example.com wrote:
On 6/10/2017 11:27 PM, Joshua Morton wrote:
Neal: As for why zip (at first I thought you meant the zip function, not
the zip compression scheme) is included and rle is not, zip is (or was), I believe, used as part of python's packaging infrastructure, hopefully someone else can correct me if that's untrue.
cpython can run from a zipped version of the stdlib. In fact, sys.path contains 'C:\Programs\Python36\python36.zip'
-- Terry Jan Reedy
Python-ideas mailing list Pythonfirstname.lastname@example.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/