Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20457
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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; 'subject:Python': 0.05; 'behave': 0.07; 'python': 0.08; 'append': 0.09; 'underlying': 0.09; 'am,': 0.12; 'docs,': 0.16; 'cc:addr:python-list': 0.16; 'subject:question': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'cheers,': 0.20; 'java': 0.21; 'cc:no real name:2**0': 0.21; "aren't": 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'knowing': 0.23; 'received:209.85.212.46': 0.23; 'received:mail- vw0-f46.google.com': 0.23; 'sfxlen:0': 0.23; 'cc:2**0': 0.26; 'mainly': 0.28; 'lists': 0.28; "i'm": 0.28; 'message- id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'array': 0.30; 'yes.': 0.30; 'chris': 0.30; 'received:209.85.212': 0.33; "can't": 0.33; 'calling': 0.34; 'subject:lists': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'linked': 0.38; 'received:209': 0.39; 'more': 0.61; 'below': 0.62; 'guarantee': 0.66; '10:20': 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; bh=3ilyuKJYoczTrFSjrr7Ok6FFbAdAaaxOfVRegk9Cbis=; b=LkbXtZGt3o0IrcYBdceHD3awa6kucrnJp1Dku71Zbr4SXWF2aZD2U5vJWZZCPcQgRW SgM+YItpNXQjPCBc+BACcvILgMsjzuUPU4LondYQ/FQLRX1Z71ltF9FMqqBCLv/04zo6 NILenJrX5I+ihVJsb4g4W2qGEblxC4tSBQpFg= |
| MIME-Version | 1.0 |
| Sender | chris@rebertia.com |
| In-Reply-To | <franck-B0D585.19202115022012@news.free.fr> |
| References | <franck-B0D585.19202115022012@news.free.fr> |
| Date | Wed, 15 Feb 2012 10:35:25 -0800 |
| X-Google-Sender-Auth | VffW2TMJVN_Sn-tzjufErR2DB9I |
| Subject | Re: Complexity question on Python 3 lists |
| From | Chris Rebert <clp2@rebertia.com> |
| To | Franck Ditter <franck@ditter.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-Gm-Message-State | ALoCoQmizMU6pYOcWnth5hLLbfD1rgV+87Rk4uP0bmz+tqAs5QosoN/YP7VIMJ1MVwiLEnjT15A0 |
| Cc | python-list@python.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.5841.1329330928.27778.python-list@python.org> (permalink) |
| Lines | 13 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1329330928 news.xs4all.nl 6912 [2001:888:2000:d::a6]:33307 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:20457 |
Show key headers only | View raw
On Wed, Feb 15, 2012 at 10:20 AM, Franck Ditter <franck@ditter.org> wrote: > What is the cost of calling primes(n) below ? I'm mainly interested in > knowing if the call to append is O(1), even amortized. > Do lists in Python 3 behave like ArrayList in Java (if the capacity > is full, then the array grows by more than 1 element) ? Yes. Python lists aren't linked lists. list.append() resizes the underlying array intelligently to give O(1) performance, although I can't find any guarantee of this in the docs, but it is true in practice for all major Python implementations. Cheers, Chris
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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