Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111435

Re: Compression

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Compression
Date Thu, 14 Jul 2016 10:59:05 +0200
Organization None
Lines 20
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>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de buociqBClNMlRfDC74u0sQn1+mQ7/calQ9e4CT3pgpHg==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'redundancy': 0.16; 'wrote:': 0.16; 'string': 0.17; '>>>': 0.20; "skip:' 40": 0.22; 'space.': 0.22; 'import': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'skip:m 30': 0.27; 'quarter': 0.29; 'random': 0.29; "d'aprano": 0.33; 'steven': 0.33; 'saved': 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'received:org': 0.37; 'skip:5 10': 0.37; 'data': 0.39; "didn't": 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'some': 0.40
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57bd80d0.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <nm7k8q$s0v$1@ger.gmane.org>
X-Mailman-Original-References <57874a72$0$2910$c3e8da3$76491128@news.astraweb.com>
Xref csiph.com comp.lang.python:111435

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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