Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10742

Re: range() vs xrange() Python2|3 issues for performance

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 <rosuav@gmail.com>
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 <prNZp.31508$js7.12436@newsfe01.iad> <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 <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1784.1312301183.1164.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Tue, Aug 2, 2011 at 3:45 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

range() vs xrange()  Python2|3 issues for performance harrismh777 <harmar@member.fsf.org> - 2011-08-02 02:12 -0500
  Re: range() vs xrange()  Python2|3 issues for performance garabik-news-2005-05@kassiopeia.juls.savba.sk - 2011-08-02 07:51 +0000
  Re: range() vs xrange()  Python2|3 issues for performance Peter Otten <__peter__@web.de> - 2011-08-02 11:05 +0200
  Re: range() vs xrange()  Python2|3 issues for performance Stefan Behnel <stefan_ml@behnel.de> - 2011-08-02 11:20 +0200
  Re: range() vs xrange()  Python2|3 issues for performance Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-08-02 11:26 +0200
  Re: range() vs xrange() Python2|3 issues for performance Chris Angelico <rosuav@gmail.com> - 2011-08-02 10:52 +0100
  Re: range() vs xrange() Python2|3 issues for performance Chris Angelico <rosuav@gmail.com> - 2011-08-02 11:19 +0100
  Re: range() vs xrange()  Python2|3 issues for performance Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-03 00:45 +1000
    Re: range() vs xrange() Python2|3 issues for performance Chris Angelico <rosuav@gmail.com> - 2011-08-02 17:06 +0100
  Re: range() vs xrange()  Python2|3 issues for performance Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-04 13:01 +1000
    Re: range() vs xrange() Python2|3 issues for performance Chris Angelico <rosuav@gmail.com> - 2011-08-04 07:59 +0100
      Re: range() vs xrange() Python2|3 issues for performance Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-04 19:56 +1000

csiph-web