Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(at': 0.04; 'expressions': 0.07; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; ':-)': 0.16; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'skip': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'fastest': 0.30; 'perl': 0.31; 'regular': 0.32; 'knows': 0.35; 'but': 0.35; 'method': 0.36; 'should': 0.36; 'sometimes': 0.38; '8bit%:86': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'everybody': 0.60; 'subject:skip:S 10': 0.84; 'choice.': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Serhiy Storchaka Subject: Re: Find and Replace Simplification Date: Sat, 20 Jul 2013 14:48:18 +0300 References: <51e967bb$0$29971$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 95.111.237.150 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374320911 news.xs4all.nl 15891 [2001:888:2000:d::a6]:53224 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50960 19.07.13 21:08, Skip Montanaro написав(ла): > Serhiy> The string replace() method is fastest (at least in Python 3.3+). See > Serhiy> implementation of html.escape() etc. > I trust everybody knows by now that when you want to use regular > expressions you should shell out to Perl for the best performance. :-) If you want to use regular expressions Python is not the best choice. But if you want to use Python regular expressions sometimes are the best choice.