Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51011
| Return-Path | <joshua.landau.ws@gmail.com> |
|---|---|
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.160 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.70; '*S*': 0.02; 'string': 0.09; 'builtin': 0.09; 'cc:addr:python-list': 0.11; 'rebuild': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'not,': 0.20; 'seems': 0.21; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; '>>>>': 0.31; 'faster,': 0.31; 'received:google.com': 0.35; 'i.e.': 0.36; 'should': 0.36; 'too': 0.37; 'implement': 0.38; '8bit%:86': 0.38; 'mapping': 0.38; 'does': 0.39; 'analyze': 0.60; 'most': 0.60; 'real': 0.63; 'such': 0.63; 'july': 0.63; 'to:addr:gmail.com': 0.65; 'overall': 0.69; 'theoretical': 0.74; '.replace': 0.84; 'subject:skip:S 10': 0.84; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=vd64ZrvX6eKGf5XisDPL5CQlUNfz8FXBx4jE6jTWdEA=; b=t4F0Rmw7rGGrCHFpwgO8Su0rm8f5x1e5maRe+wJAonOxUiX67N1PpHJLn/PgqptULf I7mRqRN60XqRfcDC/XbKJYaTby4eqpdnjVDTEpP1noNN+3u/Ep5Kdnj2Mk301vNee1Ft PsCWIZN9aFS9vcnPSwjxSiqv8QKY9+cCd6WdrdwbohmIgmDnwm3KgGm0HiDl1dTxWyNB yKHL6jyR3JESl7wLKuMRnS2zDYlJ4y32Cp65nbdblPapZ+psfrcA5oLw7JvoR8ritd2m ORG8sGWn8iitXSRIu6D9GiouJFYobBabN8oPoXWKBuiFV+HRuLfWcUn85WELwejMak7R Ko6A== |
| X-Received | by 10.152.120.228 with SMTP id lf4mr10782687lab.65.1374411009496; Sun, 21 Jul 2013 05:50:09 -0700 (PDT) |
| MIME-Version | 1.0 |
| Sender | joshua.landau.ws@gmail.com |
| In-Reply-To | <ksgk53$e6e$1@ger.gmane.org> |
| References | <mailman.4865.1374240179.3114.python-list@python.org> <51e967bb$0$29971$c3e8da3$5496439d@news.astraweb.com> <ksbt1a$5q1$1@ger.gmane.org> <CAN1F8qXttLWtMFDED-+gEdOR_5tZmDKtqDsF2kdojCRSMAn7eg@mail.gmail.com> <ksdtu7$ctm$1@ger.gmane.org> <CAN1F8qVv0N1D=JEkvWeQePhZg7fT7ULPPXp+ZTOmu=wQCzXiHQ@mail.gmail.com> <ksg3gh$ts9$1@ger.gmane.org> <CAN1F8qXcyMZ=6od+V75=9F2fwXHKiZ643PtbnrFer5i+S3i_BQ@mail.gmail.com> <ksgk53$e6e$1@ger.gmane.org> |
| From | Joshua Landau <joshua@landau.ws> |
| Date | Sun, 21 Jul 2013 13:49:29 +0100 |
| X-Google-Sender-Auth | VtGdN_LEl_FCqOwEkiw12OZfdL4 |
| Subject | Re: Find and Replace Simplification |
| To | Serhiy Storchaka <storchaka@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list <python-list@python.org> |
| 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.4953.1374411017.3114.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1374411017 news.xs4all.nl 15938 [2001:888:2000:d::a6]:40159 |
| X-Complaints-To | abuse@xs4all.nl |
| Path | csiph.com!usenet.pasdenom.info!news.franciliens.net!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
| Xref | csiph.com comp.lang.python:51011 |
Show key headers only | View raw
On 21 July 2013 13:28, Serhiy Storchaka <storchaka@gmail.com> wrote:
> 21.07.13 14:29, Joshua Landau написав(ла):
>
>> On 21 July 2013 08:44, Serhiy Storchaka <storchaka@gmail.com> wrote:
>>>
>>> 20.07.13 20:03, Joshua Landau написав(ла):
>>>
>>>> Still, it seems to me that it should be optimizable for sensible
>>>> builtin types such that .translate is significantly faster, as there's
>>>> no theoretical extra work that .translate *has* to do that .replace
>>>> does not, and .replace also has to rebuild the string a lot of times.
>>>
>>>
>>> You should analyze overall mapping and reorder items in right order (if
>>> it
>>> possible), i.e. '&' should be replaced before '<' in html.escape. This
>>> extra
>>> work is too large for most real input.
>>
>>
>> I don't understand. What items are you reordering?
>
>
> mapping.items(). We can implement s.translate({ord('<'): '<', ord('&'):
> '&'}) as s.replace('&', '&').replace('<', '<'), but not as
> s.replace('<', '<').replace('&', '&').
I see -- that won't always be the case though, as there can be "loops"
aka "ab" -> "ba".
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Find and Replace Simplification Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-19 09:22 -0400
Re: Find and Replace Simplification Novocastrian_Nomad <gregory.j.baker@gmail.com> - 2013-07-19 06:38 -0700
Re: Find and Replace Simplification John Gordon <gordon@panix.com> - 2013-07-19 14:28 +0000
Re: Find and Replace Simplification Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-19 16:22 +0000
Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-19 20:29 +0300
Re: Find and Replace Simplification Skip Montanaro <skip@pobox.com> - 2013-07-19 13:08 -0500
Re: Find and Replace Simplification Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-19 17:44 -0400
Re: Find and Replace Simplification Dave Angel <davea@davea.name> - 2013-07-19 18:45 -0400
Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 12:16 +0100
Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-20 14:48 +0300
Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-20 14:57 +0300
Re: Find and Replace Simplification Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 08:41 -0400
Re: Find and Replace Simplification Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 08:50 -0400
Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 18:03 +0100
Re: Find and Replace Simplification Dave Angel <davea@davea.name> - 2013-07-20 14:04 -0400
Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 19:37 +0100
Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 19:41 +0100
Re: Find and Replace Simplification Dave Angel <davea@davea.name> - 2013-07-20 17:56 -0400
Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 23:33 +0100
Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-21 10:44 +0300
Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-21 12:29 +0100
Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-21 15:28 +0300
Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-21 13:49 +0100
csiph-web