Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.054 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.01; 'subject:Python': 0.06; 'sys': 0.07; 'ascii': 0.09; ':-)': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '3.0': 0.19; 'not,': 0.20; '>>>': 0.22; 'import': 0.22; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'overhead': 0.31; 'steven': 0.31; 'received:google.com': 0.35; 'there': 0.35; "didn't": 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'more': 0.64; 'different.': 0.84; 'seriously,': 0.84; 'subject:long': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=T4Y3f5EIlbzwyoI1cD+c6Iu/u98tyM4ORUuiHp6RWeg=; b=yoEl9gPWBauCuQd8YEwFpBPFmrCzOl4ciqdA6NjH9nkcwZkWJuyrucYzuZsktNMDv5 iDDvn2QSJ7mJ5NJABbyK0MUsJTikHvn/nI4WudVZOJZsqBhBxqKiPtI0tdYT4UuOMEs/ 16uxfIbnuAxZdNilQLQUepV2nBZyNRolJijA0GGq5MZKvU3cEWs5sfgUJNVAJg2noHNN AHZ+JBGeRujUaGcP1ZhfP1VYuoFuGQUJmYk4v3oVqDa6H+N8BVvBO5pelgtFcKB4R5cj vE/vvN0VV0MaoS47t2izqPH0rZZQLVAUlbK4iqDBD+Kr+vA84nFo4MvdN2vWlxExtzD5 lstg== X-Received: by 10.66.164.6 with SMTP id ym6mr4390829pab.92.1365008063523; Wed, 03 Apr 2013 09:54:23 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <515be00e$0$29891$c3e8da3$5496439d@news.astraweb.com> References: <4103dc28-a0dc-4740-bb38-b6bcb58bedfb@h1g2000vbx.googlegroups.com> <87dff083-14d8-4163-89f3-d78a9be6c802@c15g2000vbl.googlegroups.com> <3qadncD4-6fcPsbMnZ2dnUVZ_rqdnZ2d@westnet.com.au> <515bbedb$0$29891$c3e8da3$5496439d@news.astraweb.com> <515be00e$0$29891$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Wed, 3 Apr 2013 10:53:43 -0600 Subject: Re: Performance of int/long in Python 3 To: Python 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365008072 news.xs4all.nl 6854 [2001:888:2000:d::a6]:54117 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42686 On Wed, Apr 3, 2013 at 1:53 AM, Steven D'Aprano wrote: > (sys.getsizeof(s) - sys.getsizeof(''))/len(s) >>> s = '\x80\x81\x82\x83\x84\x85' >>> len(s) 6 >>> import sys >>> sys.getsizeof(s) 43 >>> sys.getsizeof(s) - sys.getsizeof('') 18 >>> (sys.getsizeof(s) - sys.getsizeof('')) / len(s) 3.0 I didn't know there was a 3-byte-width representation. :-) More seriously, it fails because '' is ASCII and s is not, and the overhead for the two strings is different.