Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'broken': 0.03; 'none,': 0.05; 'preferably': 0.05; 'subject:skip:s 10': 0.05; '"if': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.10; 'cases': 0.15; "skip:' 30": 0.15; "'a',": 0.16; 'cryptic': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; "{'a':": 0.16; 'wrote:': 0.17; 'url:edu': 0.18; 'combination': 0.22; 'wednesday,': 0.22; 'example': 0.23; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.28; '"in': 0.29; 'it."': 0.29; 'this.': 0.29; 'from:addr:yahoo.co.uk': 0.32; 'johnson': 0.32; "skip:' 20": 0.32; "aren't": 0.33; 'skip:j 20': 0.33; 'problem': 0.33; 'to:addr :python-list': 0.33; 'consistent': 0.35; 'table': 0.35; 'received:org': 0.36; 'really': 0.36; 'skip:{ 10': 0.36; 'should': 0.36; 'enough': 0.36; 'bad': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'easy': 0.60; 'face': 0.61; 'charset:windows-1252': 0.65; 'special': 0.73; "'2',": 0.84; '2013': 0.84; 'rick': 0.91; 'refuse': 0.93; 'url:cc': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: string.replace doesn't removes ":" Date: Wed, 13 Feb 2013 16:55:36 +0000 References: <92122dd3-ac2e-4407-87ed-0b250ed9c8b9@googlegroups.com> <25d2297a-6fee-4ef5-bcbd-e26a28cf6ce4@e10g2000vbv.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 92.18.40.255 User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: X-Antivirus: avast! (VPS 130213-0, 13/02/2013), Outbound message X-Antivirus-Status: Clean 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: 65 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360774412 news.xs4all.nl 6916 [2001:888:2000:d::a6]:32924 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38823 On 13/02/2013 16:34, Rick Johnson wrote: > On Wednesday, February 13, 2013 1:10:14 AM UTC-6, jmfauth wrote: >> >>>>> d = {ord('a'): 'A', ord('b'): '2', ord('c'): 'C'} >>>>> 'abcdefgabc'.translate(d) >> 'A2CdefgA2C' >>>>> >>>>> >>>>> def jmTranslate(s, table): >> ... table = {ord(k):table[k] for k in table} >> ... return s.translate(table) >> ... >>>>> d = {'a': 'A', 'b': '2', 'c': 'C'} >>>>> jmTranslate('abcdefgabc', d) >> 'A2CdefgA2C' >>>>> d = {'a': None, 'b': None, 'c': None} >>>>> jmTranslate('abcdefgabc', d) >> 'defg' >>>>> d = {'a': '€€€€€', 'b': '€€€€', 'c': '€€€€'} >>>>> jmTranslate('abcdefgabc', d) >> '€€€€€€€€€€€€€defg€€€€€€€€€€€€€' > > [quip] I just really prefer a cryptic solution to a problem when a simplistic and consistent approach would suffice.[/quip] TO HELL WITH THE ZEN! > > "Beautiful is better than ugly." > BROKEN! > > "Explicit is better than implicit." > BROKEN! > > "Simple is better than complex." > BROKEN! > > "Sparse is better than dense." > BROKEN! > > "Readability counts." > BROKEN BROKEN BROKEN!!!! > > "Special cases aren't special enough to break the rules." > BROKEN! > > "In the face of ambiguity, refuse the temptation to guess." > BROKEN! > > "There should be one-- and preferably only one --obvious way to do it." > BROKEN BROKEN BROKEN! > > "If the implementation is hard to explain, it's a bad idea." > BROKEN! > > "If the implementation is easy to explain, it may be a good idea." > REINFORCED BY BAD EXAMPLE > jmf and rr in combination reminded me of this. I hope you all get my drift :) http://www.cc.gatech.edu/fac/Spencer.Rugaber/poems/love.txt -- Cheers. Mark Lawrence