Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'output': 0.05; 'subject:Python': 0.06; '(all': 0.07; '1100': 0.09; 'formatting': 0.09; 'non-text': 0.09; 'whole,': 0.09; '\xa0we': 0.09; 'cc:addr :python-list': 0.11; 'bug': 0.12; 'gui': 0.12; 'ascii,': 0.16; 'cc:name:python list': 0.16; 'regression': 0.16; 'subject:son': 0.16; 'suite.': 0.16; 'files.': 0.16; 'wrote:': 0.18; 'differ': 0.19; 'input': 0.22; 'example': 0.22; 'email addr:gmail.com>': 0.22; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'directory.': 0.24; 'instance,': 0.24; 'replace': 0.24; 'script.': 0.24; 'cc:2**0': 0.24; "i've": 0.25; '>': 0.26; 'task': 0.26; '(for': 0.26; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'on,': 0.29; 'am,': 0.29; 'reporting': 0.29; 'compared': 0.30; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'trivial': 0.31; 'file': 0.32; 'run': 0.32; 'another': 0.32; 'quite': 0.32; 'text': 0.33; 'fri,': 0.33; 'implemented': 0.33; 'ourselves': 0.33; 'could': 0.34; 'agree': 0.35; 'common': 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; '14,': 0.36; 'format.': 0.36; 'doing': 0.36; 'similar': 0.36; 'skip:& 10': 0.38; 'tasks': 0.38; 'files': 0.38; 'pm,': 0.38; 'skip:& 20': 0.39; 'extremely': 0.39; 'even': 0.60; 'challenge': 0.61; 'new': 0.61; 'information': 0.63; 'name': 0.63; 'our': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'containing': 0.69; 'obvious': 0.74; 'subject:wants': 0.74; 'you:': 0.81; "'new'": 0.84; 'now]': 0.84; 'armed': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OF36e5AU/+Mq7tibvzkFbqY5aaly9mJT0ZsKwnIserM=; b=vgOnF5oP/LN+ZSDpA1JijB969Plx9RHupxvYKOne8BLc0NSJJk2Gs5YzZesopIJi4Y msOSkUEBh4xxM5ibG9g4yJ900Pl05OTmWuejSvBQqwoi1XKS8bJsQ7YJ6mm3aYVUS7Vz 40/sh8Du91riCOMXTwFJE4XOLwfQC6tBRwGBKRkBQbfYdwr7JO3P/APOMzuWm/7o3WzG xWHeUQYAf7puUXwhZN1DsXH2Dcs8QkMCD0hTYTfG65lXN1FKkY/pBsC53Susls7vxZGy +g2sb/0PC5EykhT6tyXeCgW+klXKZuNNWajABLSu13I71y3ZN6esqWkC0vyG62kQp2HV QChg== MIME-Version: 1.0 X-Received: by 10.194.9.101 with SMTP id y5mr1974190wja.86.1371229392257; Fri, 14 Jun 2013 10:03:12 -0700 (PDT) In-Reply-To: References: <637daa98-9a0e-46ab-bb9a-f5638b7c0038@googlegroups.com> <51bab49a$0$29997$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 14 Jun 2013 13:03:12 -0400 Subject: Re: My son wants me to teach him Python From: Jason Swails To: Chris Angelico Content-Type: multipart/alternative; boundary=047d7b5d5058d4c81c04df2038f6 Cc: python list 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: 94 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371229394 news.xs4all.nl 15937 [2001:888:2000:d::a6]:41599 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48186 --047d7b5d5058d4c81c04df2038f6 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Jun 14, 2013 at 3:21 AM, Chris Angelico wrote: > On Fri, Jun 14, 2013 at 4:13 PM, Steven D'Aprano > wrote: > > Here's another Pepsi Challenge for you: > > > > There is a certain directory on your system containing 50 text files, and > > 50 non-text files. You know the location of the directory. You want to > > locate all the text files in this directory containing the word > > "halibut", then replace the word "halibut" with "trout", but only if the > > file name begins with a vowel. > > That sounds extremely contrived, to be honest. I agree that it sounds contrived, but I've found analogous tasks to be quite common in the program suite I work on, actually. We have a set of regression tests for obvious reasons. To give an order of magnitude estimate here, there are over 1100 saved test files that get compared when we run the test suite. When a change is made to the information reporting (for instance, if we added a new input variable) or version number that is printed in the output files, we have ourselves ~2K files. We then have to scan through all 2K files (some of which are ASCII, others of which are binary), typically armed with a regex that identifies the formatting change we just implemented and change the saved test files (all file names that end in .save) to the 'new' format. Our task is to find only those files that end in .save and replace only those files that differ only by the trivial formatting change to avoid masking a bug in the test suite. [I'm actually doing this now] On the whole, it sounds quite similar to Steven's example (only significantly more files), and is something not even RR could do in a GUI faster than I can run a script. --047d7b5d5058d4c81c04df2038f6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

<= /div>


On Fri, = Jun 14, 2013 at 3:21 AM, Chris Angelico <rosuav@gmail.com> wr= ote:
On Fri, Jun 14, 2013 at 4:= 13 PM, Steven D'Aprano
<steve+comp.la= ng.python@pearwood.info> wrote:
> Here's another Pepsi Challenge for you:
>
> There is a certain directory on your system containing 50 text files, = and
> 50 non-text files. You know the location of the directory. You want to=
> locate all the text files in this directory containing the word
> "halibut", then replace the word "halibut" with &q= uot;trout", but only if the
> file name begins with a vowel.

That sounds extremely contrived, to be honest.=A0
I agree tha= t it sounds contrived, but I've found analogous tasks to be quite commo= n in the program suite I work on, actually.

We have a set of regression = tests for obvious reasons. =A0To give an order of magnitude estimate here, = there are over 1100 saved test files that get compared when we run the test= suite.

When a change is made to the= information reporting (for instance, if we added a new input variable) or = version number that is printed in the output files, we have ourselves ~2K f= iles. =A0We then have to scan through all 2K files (some of which are ASCII= , others of which are binary), typically armed with a regex that identifies= the formatting change we just implemented and change the saved test files = (all file names that end in .save) to the 'new' format. Our task is= to find only those files that end in .save and replace only those files th= at differ only by the trivial formatting change to avoid masking a bug in t= he test suite. [I'm actually doing this now]

On the whole, it sounds quit= e similar to Steven's example (only significantly more files), and is s= omething not even RR could do in a GUI faster than I can run a script.


--047d7b5d5058d4c81c04df2038f6--