Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!fdn.fr!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; '64-bit': 0.07; '32-bit': 0.09; 'pointers': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; '24,': 0.16; '4gb': 0.16; 'entries.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'heap': 0.16; 'integer,': 0.16; 'reedy': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'bit': 0.19; 'slightly': 0.19; '>>>': 0.22; 'memory': 0.22; 'example': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'array': 0.29; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'probably': 0.32; 'alone': 0.33; 'fri,': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'list.': 0.37; 'minimum': 0.38; 'list,': 0.38; 'pm,': 0.38; 'enough': 0.39; 'even': 0.60; "you're": 0.61; 'absolutely': 0.87; '32gb': 0.91; 'subject:Lists': 0.91; 'to:none': 0.92; 'insane': 0.93 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:cc :content-type; bh=B8kvMOOZtrhN0jhPbnJgABr5Ynz2/KIgdEbF5kOm4Cg=; b=awY8r8j7QS5ysPRAfzTfth3M67eOW2Kq9+pzTNP79ES/oDvtOcOnwLaF38wNna3ODk cdH5aFO2K0zU9kx2tUGgcH3q2pP0OHRfDY6PHTMhOHQydqFxmork2gh9IEz2GYAFFHGX OAz3QT8MyHtqqciofcd6LEkfTASr4nfQD9vTRcw2xVr5oOGBO8oR8lcKQ5WiWXzkk3SA Rk7+QYuu4aqjRPeJY1Cb1ZV3D+19f3+QNqjmBXLSFaR8jnyJdy6RhMAuUjzPVqyt0908 55ApeDc9po1qL7w3+byfqb4iXEI9YuxGtMFzNDwvDb6Rp2DgkFEETc0dcAocEVds9XSI maiw== MIME-Version: 1.0 X-Received: by 10.170.214.6 with SMTP id g6mr2042808ykf.34.1414121538744; Thu, 23 Oct 2014 20:32:18 -0700 (PDT) In-Reply-To: References: Date: Fri, 24 Oct 2014 14:32:18 +1100 Subject: Re: I am out of trial and error again Lists From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414121549 news.xs4all.nl 2900 [2001:888:2000:d::a6]:42248 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79556 On Fri, Oct 24, 2014 at 2:14 PM, Terry Reedy wrote: > Example that works 'instantly' in 3.x, but would be slightly insane in 2.x, > even if you have enough memory for it to work on a 64 bit build. > >>>> r =range(0, 1000000000000000, 999937) >>>> 3428761974385 in r > False >>>> 3428761974386 in r > True That's over a billion entries. The array of pointers alone would be roughly 4GB on a 32-bit build, so there's no way that'll ever fit... on a 64-bit build, that'll take up 8GBish for the list, plus probably 24 bytes minimum per integer, so even if there's absolutely no heap overhead, you're still looking at 32GB to store that list. Yeeeouch. I think we can drop the "slightly" from your description! For comparison, a 64-bit Python 3 says: >>> sys.getsizeof(range(0, 1000000000000000, 999937)) 48 Thanks, much nicer. ChrisA