Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:string': 0.09; 'sucks': 0.09; 'wrong,': 0.09; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'things.': 0.19; '>>>': 0.22; 'sorry,': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '>>>>': 0.31; 'overhead': 0.31; 'probably': 0.32; 'maybe': 0.34; 'received:google.com': 0.35; 'really': 0.36; 'subject:?': 0.36; 'operating': 0.37; 'represent': 0.38; 'awesome': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'even': 0.60; 'entire': 0.61; 'subject:long': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=gkXKL64+dUTGdbGs9y1s723EZviFHx+XEG1asI4oBy4=; b=g3ryI0LZ/ulYUeCj25Qsup80fE8ggTq6H2NtOAwqDc9YYs4gTbt3hv5XWJR1Spjhg3 H/QxlzrINbqseyWdBiaAXio34UHByP3uWJsw3USL7/Om4iEwh74C8pk9k0Uy99dt7lUZ enXhzsoQW1QXE8TZ3oifmd95oc2KdvRy5n7cQGEkd8Ww470agJX82ZL9HOy/7UPgmVnc 5tJyaHoZyR2zJEA22vrCSn+gOaVaQWRQ+A3U8cVN3tE1z+66UCXao1jtpWs9fF/ouGFa UFh3DKktpSjRqm4eivgElabUqcpx/vBYAnJjvi6K4sv5/HN/kXJMRAdiIaxLAKfRCztr Y7rg== MIME-Version: 1.0 X-Received: by 10.68.217.226 with SMTP id pb2mr16836272pbc.165.1383943990848; Fri, 08 Nov 2013 12:53:10 -0800 (PST) In-Reply-To: References: Date: Sat, 9 Nov 2013 07:53:10 +1100 Subject: Re: chunking a long string? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383943995 news.xs4all.nl 15946 [2001:888:2000:d::a6]:51998 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58857 On Sat, Nov 9, 2013 at 7:43 AM, wrote: > Oops, sorry, I'm wrong, it can be much more. > >>>> sys.getsizeof('ab') > 27 >>>> sys.getsizeof('a\U0001d11e') > 48 >>>> I know, overhead sucks doesn't it. Python is really abysmal at that; look how big a single bit is: >>> sys.getsizeof(1) 14 >>> sys.getsizeof(True) 14 On the flip side, Python gets really awesome at some other things. Your operating system probably takes an entire CD to distribute, maybe even a DVD, so that's either 700MB or 4.7GB, give or take. Look how efficiently Python can represent it: >>> sys.getsizeof(os) 36 Wow! ChrisA