Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'think,': 0.07; 'string': 0.09; 'integers': 0.09; 'since.': 0.09; 'python': 0.11; 'stored': 0.12; 'digits.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hmm.': 0.16; 'it),': 0.16; 'longs': 0.16; 'reinstated': 0.16; 'types,': 0.16; 'wider': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'not,': 0.20; 'integer': 0.24; 'versions': 0.24; 'long,': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'characters': 0.30; 'message-id:@mail.gmail.com': 0.30; 'too.': 0.31; '(on': 0.31; '13,': 0.31; "d'aprano": 0.31; 'int,': 0.31; 'steven': 0.31; 'yields': 0.31; 'ago': 0.33; 'maybe': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'done': 0.36; "didn't": 0.36; 'possible': 0.36; 'handle': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'remove': 0.60; 'is.': 0.60; 'jul': 0.74; 'whereas': 0.91; '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=ydlNkg4UnRkJg1P7e7VM9LInNfduO0VIqJBqmseokNM=; b=HgprnCHWgNBwxs6H7JG1puioQQoR2t+Rp0SxBo15cy3qIQ6+/coJst82zovx80bjVf ix+s4a8IOUBsa7jjD9nb70LFQCoTWX0tkEi3QScSBYuAuQhvvdekBooTIWWGFYyA2zSr nVcpw4a6vQX/SrdEZlXpWU4Xo9MgS0IZJndyWNtTnsmj3RHeLpatp9/INj2UHREUgBRK ynUjRlZhvhDJrd4B72lqAwA4h2FCW26CHfNde9dJZFcKxryyiqRxLcoNhAgSFihLryUk JGHkTy4/guq2ZV61s+xwct9BYYSkgxlULWwXA1VvSHcLRNOIXOMuoWHkEJ7jUX8QyEYP AeKA== MIME-Version: 1.0 X-Received: by 10.52.120.77 with SMTP id la13mr21948268vdb.23.1373710144612; Sat, 13 Jul 2013 03:09:04 -0700 (PDT) In-Reply-To: <51e12295$0$9505$c3e8da3$5496439d@news.astraweb.com> References: <7ef8c0e7-7f7c-4a22-89a9-50f62c4a8064@googlegroups.com> <26d5c832-eaa1-439e-af61-e2855af2cd18@googlegroups.com> <2165f7cc-b9bf-41b1-b128-d33b522046dc@googlegroups.com> <51e12295$0$9505$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 13 Jul 2013 20:09:04 +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=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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373710147 news.xs4all.nl 15962 [2001:888:2000:d::a6]:33775 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50589 On Sat, Jul 13, 2013 at 7:49 PM, Steven D'Aprano wrote: > Ironically, Python has done the same thing for integers for many versions > too. They just didn't call it "Flexible Integer Representation", but > that's what it is. For integers smaller than 2**31, they are stored as C > longs (plus object overhead). For integers larger than 2**31, they are > promoted to a BigNum implementation that can handle unlimited digits. Hmm. That's true of Python 2 (mostly - once an operation yields a long, it never reverts to int, whereas a string will shrink if you remove the wider characters from it), but not, I think, of Python 3. The optimization isn't there any more. At least, I did some tinkering a while ago (on 3.2, I think), so maybe it's been reinstated since. As of Python 3 and the unification of types, it's definitely possible to put that in as a pure optimization, anyhow. ChrisA