Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43609
| Path | csiph.com!usenet.pasdenom.info!news.albasani.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.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'cpython': 0.05; 'explicit': 0.07; 'modify': 0.07; 'string': 0.09; "system's": 0.09; 'python': 0.11; 'mostly': 0.14; 'thread': 0.14; "wouldn't": 0.14; 'exist;': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'interpreter,': 0.16; 'optimised': 0.16; 'sorts': 0.16; 'subject:howto': 0.16; 'subject:remove': 0.16; 'why,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'possible,': 0.19; '>>>': 0.22; 'convenient': 0.24; 'mon,': 0.24; '15,': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'testing': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'asked': 0.31; 'code': 0.31; '+0100,': 0.31; 'constant': 0.31; 'convenience': 0.31; "d'aprano": 0.31; 'equality': 0.31; 'steven': 0.31; 'another': 0.32; 'open': 0.33; 'actual': 0.34; 'subject:the': 0.34; 'advice': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'building': 0.35; 'doing': 0.36; "didn't": 0.36; 'too': 0.37; 'operating': 0.37; 'turn': 0.37; 'performance': 0.37; 'system,': 0.38; 'depends': 0.38; 'version,': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; "you're": 0.61; 'love': 0.65; 'believe': 0.68; 'covers': 0.68; 'boost': 0.70; 'glad': 0.83; 'actually,': 0.84; 'darn': 0.84; 'hurry,': 0.84; 'dirty': 0.93; 'reply,': 0.93; '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=Qpvb/ZWT1G7aIEoZERXYnbLr7+jamRH1IsWsxw8HbyE=; b=Y4y2ooR4CIGT/TWIzU8HERoQt93htXnxx+qVuk8k2bdkKtJeWhT12qe1gxtKLU1hxP cQ/VeSTEPGLbVOc89HsV5hZtjC91E9fJbL7HAja4vBr/zdZ25vhaVHuQ6Yw5fXkswvAZ C0uu9ggCnvyLQJhHHvPiLv0frUToDkq3UHYSOvAmOOly+yH8X+zLMRxfdj033QqTuMew oH94wxEtH5qeCcrSd4j2Jcy7gSfD3+rNJvEHsmUGIShXyrRuk3hMmJ2pPSLusLRLng2K Vyhxr4VHEIuYn1UY94xY06WUllCMCx+C8WGOnuHUqvsw/CCC9CAKB9Sho8DRf4ZBWZDD CkmA== |
| MIME-Version | 1.0 |
| X-Received | by 10.52.37.109 with SMTP id x13mr13207864vdj.10.1366011565252; Mon, 15 Apr 2013 00:39:25 -0700 (PDT) |
| In-Reply-To | <516ba633$0$29872$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> <kkfnun$kpj$1@dont-email.me> <516ba633$0$29872$c3e8da3$5496439d@news.astraweb.com> |
| Date | Mon, 15 Apr 2013 17:39:25 +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.623.1366011573.3114.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1366011573 news.xs4all.nl 2678 [2001:888:2000:d::a6]:52531 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43609 |
Show key headers only | View raw
On Mon, Apr 15, 2013 at 5:03 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > On Mon, 15 Apr 2013 03:19:43 +0100, Rotwang wrote: > >> On 15/04/2013 02:14, Steven D'Aprano wrote: >>> Strings are immutable. Consider building up a single string from four >>> substrings: >> >> Actually, I believe that CPython is optimised to modify strings in place >> where possible, so that the above would surprisingly turn out to be >> O(n). See the following thread where I asked about this: > > I deliberately didn't open that can of worms, mostly because I was in a > hurry, but also because it's not an optimization you can rely on. It > depends on the version, implementation, operating system, and the exact > code running. > > As far as I'm concerned, the best advice regarding this optimization is: > > - always program as if it doesn't exist; > > - but be glad it does when you're writing quick and dirty code in the > interactive interpreter, where the convenience of string concatenation > may be just too darn convenient to bother doing the right thing. Agreed; that's why, in my reply, I emphasized that the pure Python code IS quadratic, even though the actual implementation might turn out linear. (I love that word "might". Covers myriad possibilities on both sides.) Same goes for all sorts of other possibilities. I wouldn't test string equality with 'is' without explicit interning, even if I'm testing a constant against another constant in the same module - but I might get a big performance boost if the system's interned all its constants for me. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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