Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'instance,': 0.05; 'python': 0.08; 'admit': 0.09; 'bash': 0.09; 'ssh': 0.09; 'wrote:': 0.15; 'dangerous,': 0.16; 'did,': 0.16; 'efficiently,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:() ': 0.16; 'subject:issues': 0.16; 'pm,': 0.16; 'aug': 0.19; 'slightly': 0.19; 'received:74.125.82.174': 0.19; 'received :mail-wy0-f174.google.com': 0.19; '(but': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'resources.': 0.23; 'tue,': 0.23; "i'm": 0.27; 'keeps': 0.28; 'message-id:@mail.gmail.com': 0.28; "didn't": 0.29; 'fairly': 0.30; 'threads': 0.30; "won't": 0.32; 'usually': 0.33; 'actually': 0.33; 'to:addr:python-list': 0.34; 'there': 0.34; 'quite': 0.34; 'that,': 0.35; 'running': 0.35; 'session': 0.35; '(for': 0.36; 'core': 0.36; 'open': 0.37; 'doing': 0.37; 'but': 0.37; 'another': 0.38; 'received:google.com': 0.38; 'subject:: ': 0.38; 'steven': 0.38; 'something': 0.38; 'received:74.125.82': 0.39; 'to:addr:python.org': 0.39; 'received:74.125': 0.40; 'where': 0.40; 'glad': 0.71; 'hand,': 0.76; 'anywhere!': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=WR88Cus25TK6+j9b+vmmlBVdwxicRnVth1qxpebw9p8=; b=SYCvzu9l/fHa6nc0lJtGVDFhpTU4j374vC7q8w0t5XsCXPZNeF80wTVgkmRRQgmf4u Hh0ZkZJeGds/apmfX0evInjL5B8JTMb5R+DnzxZfl+6rHNDc1utz2JIL3NUlyk6pIbfp WKli9ceu842RapTDZzL8RZ0/qyvgmhSeZTjag= MIME-Version: 1.0 In-Reply-To: <4e380d8f$0$29965$c3e8da3$5496439d@news.astraweb.com> References: <4e380d8f$0$29965$c3e8da3$5496439d@news.astraweb.com> Date: Tue, 2 Aug 2011 17:06:21 +0100 Subject: Re: range() vs xrange() Python2|3 issues for performance 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.12 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: 1312301183 news.xs4all.nl 23966 [2001:888:2000:d::a6]:38189 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10742 On Tue, Aug 2, 2011 at 3:45 PM, Steven D'Aprano wrote: > (But don't make the mistake of doing what I did, which was to attempt to > produce range(290000000) in Python 2. After multiple *hours* of swapping, I > was finally able to kill the Python process and get control of my PC again. > Sigh.) > That is sad. (And, I am only slightly ashamed to admit it, quite funny.) But on the other hand, quite impressive that it didn't bomb anywhere! Whenever I'm about to do something really dangerous, I like to first open an SSH session from another computer - bash running inside there can usually kill any process fairly efficiently, without need for UI interaction. Failing that, good ol' Ctrl-Alt-F1 to get to a console is usually the next best, but sometimes logging in requires a lot of resources. This is actually one place where I'm really glad Python doesn't do much with multiple threads (for instance, it won't gc on another thread). A dual core CPU keeps everything happy! ChrisA