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


Groups > comp.lang.python > #20465

Re: Complexity question on Python 3 lists

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
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; 'cpython': 0.05; 'subject:Python': 0.05; 'behave': 0.07; 'python': 0.08; '25,': 0.12; 'am,': 0.12; '16,': 0.15; 'case.': 0.15; '46,': 0.16; '58,': 0.16; 'url:hg': 0.16; 'cc:addr:python-list': 0.16; 'subject:question': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'slightly': 0.19; 'cheers,': 0.20; 'java': 0.21; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'received:209.85.220': 0.25; '"the': 0.26; 'lists': 0.28; "i'm": 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'array': 0.30; 'kelly': 0.30; 'pattern': 0.30; 'chris': 0.30; 'url:python': 0.35; 'subject:lists': 0.36; 'cc:2**1': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'url:org': 0.39; 'received:209': 0.39; 'more': 0.61; 'believe': 0.65; 'url:c': 0.74; '10:43': 0.84; '35,': 0.84; 'certain,': 0.84; 'sender:addr:chris': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=WwpOvR5GNt+8yOld+xBFLGTI4c767naUuGuVdO5hOm8=; b=EnMJDriWhNlLRPKBIPZStyB9nIG8sRrUtMg7fjuO0dZu23wX1/nF6lT1Ho8Ml8fQ8x oPPZkaLk2jntLxpceFtjOw8UNIa78ThUw0TDAMNhOY1MDGB89bbccvZq6HmAKNmyccyE 4LMv+ZSTDQ0EDzZ43dIUwyMEa3GSC4CR5JZiE=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <CALwzidmOuA7hWxEN+Zoy5oKmf1j7-Lc-xxPrEXmXqdnsx_DnVw@mail.gmail.com>
References <franck-B0D585.19202115022012@news.free.fr> <CALwzidmOuA7hWxEN+Zoy5oKmf1j7-Lc-xxPrEXmXqdnsx_DnVw@mail.gmail.com>
Date Wed, 15 Feb 2012 11:11:27 -0800
X-Google-Sender-Auth XUq3m9YFWcZBgX_rOD-GimRp2-I
Subject Re: Complexity question on Python 3 lists
From Chris Rebert <clp2@rebertia.com>
To Ian Kelly <ian.g.kelly@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Gm-Message-State ALoCoQm+qXSdkOqovMYhAtcHvjjAqaaKyJcWNvmuONIIX+zQmUSfBLDcaeB0BxHfWMqp3K11aiF/
Cc python-list@python.org, Franck Ditter <franck@ditter.org>
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.5847.1329333090.27778.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1329333090 news.xs4all.nl 6896 [2001:888:2000:d::a6]:43941
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20465

Show key headers only | View raw


On Wed, Feb 15, 2012 at 10:43 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Wed, Feb 15, 2012 at 11:20 AM, Franck Ditter <franck@ditter.org> wrote:
<snip>
>> Do lists in Python 3 behave like ArrayList in Java (if the capacity
>> is full, then the array grows by more than 1 element) ?
>
> I believe the behavior in CPython is that if the array is full, the
> capacity is doubled, but I'm not certain, and that would be an
> implementation detail in any case.

It's slightly more complex:
http://hg.python.org/cpython/file/096b31e0f8ea/Objects/listobject.c
"The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, …"
    -- list_resize()

Cheers,
Chris

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


Thread

Complexity question on Python 3 lists Franck Ditter <franck@ditter.org> - 2012-02-15 19:20 +0100
  Re: Complexity question on Python 3 lists Chris Rebert <clp2@rebertia.com> - 2012-02-15 10:35 -0800
  Re: Complexity question on Python 3 lists Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-15 11:43 -0700
  Re: Complexity question on Python 3 lists Dave Angel <d@davea.name> - 2012-02-15 13:45 -0500
  Re: Complexity question on Python 3 lists Stefan Behnel <stefan_ml@behnel.de> - 2012-02-15 20:01 +0100
  Re: Complexity question on Python 3 lists Chris Rebert <clp2@rebertia.com> - 2012-02-15 11:11 -0800
  Re: Complexity question on Python 3 lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-02-15 15:28 -0500
  Re: Complexity question on Python 3 lists Terry Reedy <tjreedy@udel.edu> - 2012-02-15 16:41 -0500
  Re: Complexity question on Python 3 lists Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-15 15:54 -0700
  Re: Complexity question on Python 3 lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-16 00:41 +0000

csiph-web