Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65582
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; ';-)': 0.03; '*not*': 0.07; 'subject:Question': 0.07; 'repeated': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'language,': 0.12; '-tkc': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'len(self)': 0.16; 'roy': 0.16; 'subject:`': 0.16; 'unneeded': 0.16; 'wrote:': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'performing': 0.26; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'chase': 0.31; 'operations.': 0.31; 'class': 0.32; 'fri,': 0.33; 'received:google.com': 0.35; 'there': 0.35; 'list': 0.37; 'pm,': 0.38; 'does': 0.39; 'it!': 0.67; 'promise': 0.68; 'smith': 0.68; 'skip:a 40': 0.72; 'behavior': 0.77; 'to:none': 0.92; 'imagine': 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=qZ65y8TOPDTcnO4oCOPUUsN6DPLx/mK63DJ7drDGpd0=; b=MiSAIVUeSYLbWZ3VZYSJHMF4PoG4IpJ9RzVU3BJ5rmZwTGjxw6pT34C6IHFDreeUwI yCTiUZDXtxqX+/9zeMpsm6xPEZmuBmZuIawwORyDP+VLLNLNnwnu8vRkYzDaD1CyCTOE 1uKbfjwsy2pryBY/vpNFlHf1Uzlt05zXXxTm0MVY8+IjaopiE0LGWQI31v4mGlvNL6ca oPSXWyP1vLHdf0sXNWkDsF5UHLl0FL9qXlL4C+gEHLqLuNcefbqNh5CNhITPX1vGGoGC bOXqVHOi4FQZk53XDlnixIiCe4oKIAk0tSbu3egwNx/qRXYV+WyilT52gJNxeRtHiUcn eP3A== |
| MIME-Version | 1.0 |
| X-Received | by 10.68.108.194 with SMTP id hm2mr16955345pbb.22.1391743243293; Thu, 06 Feb 2014 19:20:43 -0800 (PST) |
| In-Reply-To | <20140206211130.3ec5b0d8@bigbox.christie.dr> |
| References | <4041bba7-91bc-4803-9150-2fcf14ecb5a9@googlegroups.com> <mailman.6471.1391741496.18130.python-list@python.org> <roy-5342A1.22005606022014@news.panix.com> <20140206211130.3ec5b0d8@bigbox.christie.dr> |
| Date | Fri, 7 Feb 2014 14:20:43 +1100 |
| Subject | Re: Question about `list.insert` |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <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 <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6474.1391743247.18130.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1391743247 news.xs4all.nl 2937 [2001:888:2000:d::a6]:45067 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:65582 |
Show key headers only | View raw
On Fri, Feb 7, 2014 at 2:11 PM, Tim Chase <python.list@tim.thechases.com> wrote:
> On 2014-02-06 22:00, Roy Smith wrote:
>> > list does not promise better than O(1) behavior
>>
>> I'm not aware of any list implementations, in any language, that
>> promises better than O(1) behavior for any operations. Perhaps
>> there is O(j), where you just imagine the operation was performed?
>
> Pish...there's always O(0) which is achieved by *not* performing some
> unneeded operation ;-)
>
> -tkc
Ooh! Ooh! I got it!
class fast_list(list):
def append(self,obj,randrange=random.randrange):
if len(self) and randrange(len(self)): return
return super().append(obj)
Repeated appends to this list are amortized O(0)!
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question about `list.insert` cool-RR <ram.rachum@gmail.com> - 2014-02-06 15:59 -0800
Re: Question about `list.insert` Terry Reedy <tjreedy@udel.edu> - 2014-02-06 19:40 -0500
Re: Question about `list.insert` MRAB <python@mrabarnett.plus.com> - 2014-02-07 00:42 +0000
Re: Question about `list.insert` Terry Reedy <tjreedy@udel.edu> - 2014-02-06 21:48 -0500
Re:Question about `list.insert` Dave Angel <davea@davea.name> - 2014-02-06 21:54 -0500
Re: Question about `list.insert` Roy Smith <roy@panix.com> - 2014-02-06 22:00 -0500
Re: Question about `list.insert` Rustom Mody <rustompmody@gmail.com> - 2014-02-06 19:08 -0800
Re: Question about `list.insert` Tim Chase <python.list@tim.thechases.com> - 2014-02-06 21:11 -0600
Re: Question about `list.insert` Roy Smith <roy@panix.com> - 2014-02-06 22:12 -0500
Re: Question about `list.insert` Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-07 17:18 +1300
Re: Question about `list.insert` Chris Angelico <rosuav@gmail.com> - 2014-02-07 14:14 +1100
Re: Question about `list.insert` Chris Angelico <rosuav@gmail.com> - 2014-02-07 14:20 +1100
Re: Question about `list.insert` Rustom Mody <rustompmody@gmail.com> - 2014-02-06 19:29 -0800
Re: Question about `list.insert` Chris Angelico <rosuav@gmail.com> - 2014-02-07 14:45 +1100
Re: Question about `list.insert` Asaf Las <roegltd@gmail.com> - 2014-02-06 19:28 -0800
Re: Question about `list.insert` Dan Stromberg <drsalists@gmail.com> - 2014-02-06 20:52 -0800
Re: Question about `list.insert` Asaf Las <roegltd@gmail.com> - 2014-02-06 21:18 -0800
Re: Question about `list.insert` Peter Otten <__peter__@web.de> - 2014-02-07 09:25 +0100
csiph-web