Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; '"""': 0.07; 'pretend': 0.07; 'python': 0.08; 'hurt': 0.09; 'shame': 0.09; 'pm,': 0.10; 'this:': 0.10; 'programmer': 0.11; '>>>': 0.12; 'wrote:': 0.14; 'library': 0.15; 'from:addr:free.fr': 0.16; 'hammer': 0.16; 'neat': 0.16; 'received:212.27': 0.16; 'received:212.27.42': 0.16; 'received:free.fr': 0.16; 'roy': 0.16; 'awesome': 0.19; 'perl': 0.19; 'header:In-Reply-To:1': 0.21; 'seems': 0.21; 'tools,': 0.22; 'gregory': 0.23; "doesn't": 0.25; "i'm": 0.27; 'mode': 0.29; 'subject:?': 0.29; "python's": 0.29; 'ewing': 0.30; 'pattern': 0.30; 'tool.': 0.30; 'whitespace': 0.30; 'looks': 0.31; 'community': 0.32; 'cheers': 0.32; 'to:addr:python- list': 0.33; 'things': 0.33; 'there': 0.35; 'header:User-Agent:1': 0.35; 'using': 0.35; 'beginning': 0.37; 'something': 0.37; 'thread': 0.37; 'tool': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'received:192': 0.38; 'sometimes': 0.39; 'got': 0.39; 'to:addr:python.org': 0.39; 'really': 0.40; 'best': 0.60; 'total': 0.61; 'john': 0.62; 'attitude': 0.67; 'kinds': 0.69; 'collection': 0.72; '03:47': 0.84; 'article,': 0.84; 'compact,': 0.84; 'evolved': 0.84; 'subject:Why': 0.84; 'subject:choose': 0.84; 'subject:its': 0.84 Date: Fri, 27 May 2011 22:10:30 +0200 From: Karim User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Why did Quora choose Python for its development? References: <80d59383-36a3-4744-85c4-1a0577f1d3a6@dr5g2000vbb.googlegroups.com> <9CDC4B2CD1F445E994119A50F65155DF@teddy> <12225671E9654FECB49613D915FAEC19@teddy> <21A740B7AC6644248476DFADDF726C73@octavian> <629DAC3611EA49B0A36BCF70151CDE2F@octavian> <87sjs44qyk.fsf@castleamber.com> <87zkmcujl4.fsf@castleamber.com> <87sjs4t12l.fsf@castleamber.com> <948l8nF33pU1@mid.individual.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 38 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306527044 news.xs4all.nl 49038 [::ffff:82.94.164.166]:52528 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6428 On 05/27/2011 03:47 PM, Roy Smith wrote: > In article<948l8nF33pU1@mid.individual.net>, > Gregory Ewing wrote: > >> John Bokma wrote: >> >>> A Perl programmer will call this line noise: >>> >>> double_word_re = re.compile(r"\b(?P\w+)\s+(?P=word)(?!\w)", >>> re.IGNORECASE) > One of the truly awesome things about the Python re library is that it > lets you write complex regexes like this: > > pattern = r"""\b # beginning of line > (?P\w+) # a word > \s+ # some whitespace > (?P=word)(?!\w) # the same word again > """ > double_word_re = re.compile(pattern, re.I | re.X) > > Sometimes regex really is the best tool. It's often the most compact, > or fastest, or clearest way to express something complicated. > Fortunately, re.X mode gives you a way to write truly monster regexes > and still having them not be total line noise. > > It's a shame that the Python community has evolved to be so anti-regex > that most people never consider using them. While Perl's attitude to > regex may be "when the only tool you have is a hammer, everything looks > like a nail", Python's seems to be, "I've got a great collection of all > kinds of neat tools, so I'm going to pretend the hammer that's in there > doesn't exist because I once smashed my thumb with it and it hurt a lot". HAHAHAHAHAHA Very funny! This thread is awsome. Cheers Karim