Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'float': 0.07; 'string': 0.09; 'encode': 0.09; 'integers': 0.09; 'obsolete': 0.09; 'language,': 0.12; '16-bit': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'nope,': 0.16; 'similarly,': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'seems': 0.21; '>>>': 0.22; 'bytes': 0.24; 'char': 0.24; 'days,': 0.24; 'integer': 0.24; 'stick': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'character': 0.29; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'comparison': 0.31; 'anyone': 0.31; 'everyone': 0.33; 'skip:s 30': 0.35; 'more,': 0.35; 'objects': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'right?': 0.36; 'url:org': 0.36; 'should': 0.36; 'two': 0.37; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'space': 0.40; 'how': 0.40; 'skip:n 10': 0.64; 'more': 0.64; 'nobody': 0.68; 'funny': 0.74; 'jul': 0.74; 'clearly.': 0.84; 'many,': 0.93; '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:content-transfer-encoding; bh=/4vzgCMWGii5YmHmkXuhCjLdNn3ahOfSa+7B+DW+rxM=; b=w+/1j2PBD9UrKqwuCnGquuilkshfLHnzzmLucAEZ+fcnGWiEZoVaF4Yi1XG0qhl61j uKgtY+B16X8zJQJ4mF6kyT1Q1MIGWCS2+JFDAX1WG9hXJn0I1f9f/nY6zkbEB0uQ6PJe WZFIYst0/W8NSqcinYVVJoF47hiRC5Lm1iKuPo6ms7JRqZJRtMqPmNkYKrULqRKp9tAO 3ZUC5/l4SZcfV0YKADXzGNfLPs0JGqOsDjsQskx9O0kfbxOxBOgY9jQbWtZiQtHVMonb qTnLaDTzOxNJnJFpvf1hn1Fsn0zdDbcZzYh3byoPudELeqH2+efRKC/RG6rEVBRjIMl7 e1vA== MIME-Version: 1.0 X-Received: by 10.52.34.40 with SMTP id w8mr18127584vdi.7.1373549520282; Thu, 11 Jul 2013 06:32:00 -0700 (PDT) In-Reply-To: References: <7ef8c0e7-7f7c-4a22-89a9-50f62c4a8064@googlegroups.com> Date: Thu, 11 Jul 2013 23:32:00 +1000 Subject: Re: hex dump w/ or w/out utf-8 chars From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373549528 news.xs4all.nl 15944 [2001:888:2000:d::a6]:48982 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50444 On Thu, Jul 11, 2013 at 11:18 PM, wrote: > Just to stick with this funny character =E1=BA=9E, a ucs-2 char > in the Flexible String Representation nomenclature. > > It seems to me that, when one needs more than ten bytes > to encode it, > >>>> sys.getsizeof('a') > 26 >>>> sys.getsizeof('=E1=BA=9E') > 40 > > this is far away from the perfection. Better comparison is to see how much space is used by one copy of it, and how much by two copies: >>> sys.getsizeof('aa')-sys.getsizeof('a') 1 >>> sys.getsizeof('=E1=BA=9E=E1=BA=9E')-sys.getsizeof('=E1=BA=9E') 2 String objects have overhead. Big deal. > BTW, for a modern language, is not ucs2 considered > as obsolete since many, many years? Clearly. And similarly, the 16-bit integer has been completely obsoleted, as there is no reason anyone should ever bother to use it. Same with the float type - everyone uses double or better these days, right? http://www.postgresql.org/docs/current/static/datatype-numeric.html http://www.cplusplus.com/doc/tutorial/variables/ Nope, nobody uses small integers any more, they're clearly completely obsol= ete. ChrisA