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


Groups > comp.lang.python > #43592

Re: howto remove the thousand separator

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!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.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'algorithm': 0.04; 'modified': 0.07; 'immutable': 0.09; 'python': 0.11; 'assume': 0.14; 'does,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'janssen': 0.16; 'subject:howto': 0.16; 'subject:remove': 0.16; 'wrote:': 0.18; '(but': 0.19; 'code,': 0.22; 'mon,': 0.24; '15,': 0.26; 'second': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'needed.': 0.30; 'message-id:@mail.gmail.com': 0.30; '-0700,': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'copying': 0.34; 'subject:the': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'done,': 0.36; 'earth': 0.36; 'turn': 0.37; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'strictly': 0.61; 'first': 0.61; 'characters,': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=wD28cF+ABdCSnhJ0Xj8urJNel/sp0PZEcUWiCI1DGzo=; b=gmggV8hh/R0sg8THRfXYJaRwKrBnW/sQ9buKmaYdxn9oDGZCv+hJsrNMahT3TcPBy1 coUyDdWlB0yE1D4AZu4gYIqAenjG22oMs/VD5DjtKB5+Dqfch3s9M9gdJ5tW5t7f8hRZ 8rLatyHDvemrbj/ppHdSOLlJElEWCytcLLdQe68MRxD1zwX6KaGRvBtMYTwZRtX51QSo GnqixO8zQ0SwPM4AlCquZsk1pm/8kEpc7UIMFcA/kCjHTPhRW2IiytSP5aEyLqx2NAZT G/R7FgvMSCq+dJMLDAR5NknaCEt+AXfKu25DShEUVuAVx11KhWlUV1LDPO4tJcY3Ax66 9Ddw==
MIME-Version 1.0
X-Received by 10.58.50.7 with SMTP id y7mr14759972ven.24.1365989357728; Sun, 14 Apr 2013 18:29:17 -0700 (PDT)
In-Reply-To <516b5471$0$29977$c3e8da3$5496439d@news.astraweb.com>
References <201304150257331336590@gmail.com> <mailman.596.1365966380.3114.python-list@python.org> <516b49dc$0$29977$c3e8da3$5496439d@news.astraweb.com> <mailman.611.1365986675.3114.python-list@python.org> <516b5471$0$29977$c3e8da3$5496439d@news.astraweb.com>
Date Mon, 15 Apr 2013 11:29:17 +1000
Subject Re: howto remove the thousand separator
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.612.1365989366.3114.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365989366 news.xs4all.nl 2649 [2001:888:2000:d::a6]:59343
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43592

Show key headers only | View raw


On Mon, Apr 15, 2013 at 11:14 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Sun, 14 Apr 2013 17:44:28 -0700, Mark Janssen wrote:
>> What on earth makes you think that is an O(n**2) algorithm and not O(n)?
>
> Python *might* optimize the first concatenation, '' + 'fe', to just reuse
> 'fe', (but it might not). Let's assume it does, so that no copying is
> needed. Then it gets to the second concatenation, and now it has to copy
> characters, because strings are immutable and cannot be modified in
> place.

There are actually a lot of optimizations done, so it might turn out
to be O(n) in practice. But strictly in the Python code, yes, this is
definitely O(n*n).

ChrisA

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


Thread

Re: howto remove the thousand separator Mark Janssen <dreamingforward@gmail.com> - 2013-04-14 12:06 -0700
  Re: howto remove the thousand separator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-15 00:29 +0000
    Re: howto remove the thousand separator Mark Janssen <dreamingforward@gmail.com> - 2013-04-14 17:44 -0700
      Re: howto remove the thousand separator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-15 01:14 +0000
        Re: howto remove the thousand separator Chris Angelico <rosuav@gmail.com> - 2013-04-15 11:29 +1000
          Re: howto remove the thousand separator Walter Hurry <walterhurry@lavabit.com> - 2013-04-15 02:25 +0000
            Re: howto remove the thousand separator Roy Smith <roy@panix.com> - 2013-04-14 22:35 -0400
              Re: howto remove the thousand separator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-15 07:04 +0000
        Re: howto remove the thousand separator Rotwang <sg552@hotmail.co.uk> - 2013-04-15 03:19 +0100
          Re: howto remove the thousand separator Ned Deily <nad@acm.org> - 2013-04-14 22:15 -0700
          Re: howto remove the thousand separator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-15 07:03 +0000
            Re: howto remove the thousand separator Chris Angelico <rosuav@gmail.com> - 2013-04-15 17:39 +1000
            Re: howto remove the thousand separator Rotwang <sg552@hotmail.co.uk> - 2013-04-15 23:16 +0100

csiph-web