Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111435
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Compression |
| Date | 2016-07-14 10:59 +0200 |
| Organization | None |
| Message-ID | <mailman.60.1468486763.21009.python-list@python.org> (permalink) |
| References | <57874a72$0$2910$c3e8da3$76491128@news.astraweb.com> <nm7k8q$s0v$1@ger.gmane.org> |
Steven D'Aprano wrote: > How about some really random data? > > py> import string > py> data = ''.join(random.choice(string.ascii_letters) for i in > range(21000)) py> len(codecs.encode(data, 'bz2')) > 15220 > > That's actually better than I expected: it's found some redundancy and > saved about a quarter of the space. It didn't find any redundancy, it found the two unused bits: >>> math.log(len(string.ascii_letters), 2) 5.700439718141093 >>> 21000./8*_ 14963.654260120367
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Compression Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-07-14 18:16 +1000 Re: Compression wxjmfauth@gmail.com - 2016-07-14 01:52 -0700 Re: Compression Peter Otten <__peter__@web.de> - 2016-07-14 10:59 +0200 Re: Compression Chris Angelico <rosuav@gmail.com> - 2016-07-14 21:07 +1000
csiph-web