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


Groups > comp.lang.python > #33657

Re: Problem with list.remove() method

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.031
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'elements.': 0.05; '21,': 0.07; 'interpreted': 0.07; 'python': 0.09; 'executes': 0.09; 'subject:method': 0.09; 'language': 0.14; '(but': 0.15; '"it\'s': 0.16; ':-).': 0.16; 'adam': 0.16; 'algorithmic': 0.16; 'beautifully': 0.16; 'chris,': 0.16; 'fond': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:Problem': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'instance,': 0.17; 'saying': 0.18; 'code.': 0.20; 'received:209.85.214.174': 0.21; 'beauty': 0.22; 'second': 0.24; 'header:In-Reply-To:1': 0.25; '(most': 0.27; 'am,': 0.27; 'scale': 0.27; 'important.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'unlikely': 0.29; 'code': 0.31; 'problem.': 0.32; 'comments': 0.33; 'purposes,': 0.33; 'zero': 0.33; 'handle': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; '(with': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'nov': 0.35; 'problem,': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'subject:with': 0.36; 'should': 0.36; 'thank': 0.36; 'uses': 0.37; 'being': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'most': 0.61; 'time,': 0.62; 'worth': 0.63; 'ever': 0.63; 'skip:n 10': 0.63; 'more': 0.63; 'making': 0.64; 'dear': 0.66; 'bulk': 0.78; 'absolutely': 0.84; 'alvaro': 0.84; 'combo': 0.84; 'details...': 0.84; 'is!': 0.84; 'newcomer': 0.84; 'ridiculously': 0.84; 'inefficient': 0.91; 'poorly': 0.93; 'technique': 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:to :content-type; bh=dFPIAJpRypGKJ6ggpcFfz4kutEDeAnJJRlyeZtDkI2U=; b=pVhN9giOa/v8btr+/LIAm0Lq/EVFWxsVVKv28CblTpJ/brL9Ee9HhPn4S9V240aGxU 8fhkLsBmj5Go0PxD6GsmtabfRFvs6BskWnAYZJCGrEfPbTHiumsOuwLVjCEH9wxXKM6v VnapqKlQOxKFEHx2P68d5WciG1m1lm8m8jCm4eIVsWg1QBarO5IskswD8qLjqgP8X/Qs tOCK0jUeiyn50/MSnMrtLfIdHKKC8QENsVN/CPz7j+KqVbVwGX6n8LYEWHc0IUx/xp1F kYiCyOFFbMPbHnEuVg5SCzpUU+PGPiTPpR+sBhUjcGcsB3gS14bGp1i95TJPrmKr8U/O JMzg==
MIME-Version 1.0
In-Reply-To <9caaea9c-8b7c-4ed5-bc3b-2519a58ceb26@googlegroups.com>
References <b610616c-c26d-44e1-84c6-fa922a8e3f75@googlegroups.com> <mailman.55.1353420881.29569.python-list@python.org> <9caaea9c-8b7c-4ed5-bc3b-2519a58ceb26@googlegroups.com>
Date Wed, 21 Nov 2012 07:48:08 +1100
Subject Re: Problem with list.remove() method
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.15
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.93.1353444493.29569.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353444493 news.xs4all.nl 6903 [2001:888:2000:d::a6]:59045
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33657

Show key headers only | View raw


On Wed, Nov 21, 2012 at 1:37 AM, Alvaro Combo <alvaro.combo@gmail.com> wrote:
> Dear Chris,
>
> Thank you very much for you reply...
> For a newcomer to Python the Hell is in the details... :-).

You're most welcome! As Adam Savage of Mythbusters is fond of saying
(with an exaggerated accent), "It's all a learning experience".

> Regarding you other (most relevant) comments, I absolutely agree... BUT in those cases... I was aware :-). But since it is in fact an exercise... and having N^2 operations... is not important. Still your comments are quite pertinent.

Yep. O(N^2) isn't inherently a problem, it just means that the
technique will scale poorly to large numbers of list elements. With
small lists, it'll be "fast enough" - for all intents and purposes,
the bulk of Python code executes in zero time, despite being in an oh
so slow interpreted language and using ridiculously inefficient (but
beautifully readable) code. That's the beauty of modern hardware :)

However, I do think that people should be aware when they're writing
non-scaleable code. That's not just algorithmic complexity; if you're
making a system that won't handle more than one request a second
(because, for instance, it uses seconds-since-1970 as a request
identifier), that's something worth being aware of, even if it's
unlikely ever to be a problem. Just know, so that if a problem ever
_does_ occur, you know where it is!

ChrisA

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


Thread

Problem with list.remove() method Alvaro Combo <alvaro.combo@gmail.com> - 2012-11-20 05:56 -0800
  Re: Problem with list.remove() method Chris Angelico <rosuav@gmail.com> - 2012-11-21 01:14 +1100
    Re: Problem with list.remove() method Alvaro Combo <alvaro.combo@gmail.com> - 2012-11-20 06:37 -0800
      Re: Problem with list.remove() method Chris Angelico <rosuav@gmail.com> - 2012-11-21 07:48 +1100
    Re: Problem with list.remove() method Alvaro Combo <alvaro.combo@gmail.com> - 2012-11-20 06:37 -0800
  Re: Problem with list.remove() method Terry Reedy <tjreedy@udel.edu> - 2012-11-20 15:32 -0500
  RE: Problem with list.remove() method "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-20 20:47 +0000
  Re: Problem with list.remove() method Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-20 19:08 -0500

csiph-web