Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #48186
| References | <Pine.LNX.4.64.1306131844240.11512@tau.ceti.pl> <mailman.3219.1371154780.3114.python-list@python.org> <637daa98-9a0e-46ab-bb9a-f5638b7c0038@googlegroups.com> <51bab49a$0$29997$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmpdxRrpCKhhdj4cz7+A2QyBVeMAibZn9E3RUEh+eoNunw@mail.gmail.com> |
|---|---|
| Date | 2013-06-14 13:03 -0400 |
| Subject | Re: My son wants me to teach him Python |
| From | Jason Swails <jason.swails@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3320.1371229394.3114.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Fri, Jun 14, 2013 at 3:21 AM, Chris Angelico <rosuav@gmail.com> wrote: > On Fri, Jun 14, 2013 at 4:13 PM, Steven D'Aprano > <steve+comp.lang.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 "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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: My son wants me to teach him Python Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-13 21:18 +0100
Re: My son wants me to teach him Python Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-13 20:33 -0700
Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-14 14:02 +1000
Re: My son wants me to teach him Python Anssi Saari <as@sci.fi> - 2013-06-14 15:02 +0300
Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-15 03:12 +1000
Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-14 14:05 +1000
Re: My son wants me to teach him Python Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-16 12:04 -0700
Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-17 07:52 +1000
Re: My son wants me to teach him Python Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-16 15:33 -0700
Re: My son wants me to teach him Python Alister <alister.ware@ntlworld.com> - 2013-06-17 21:11 +0000
Re: My son wants me to teach him Python Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-14 06:11 +0100
Re: My son wants me to teach him Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-14 06:13 +0000
Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-14 17:21 +1000
Re: My son wants me to teach him Python Tim Chase <python.list@tim.thechases.com> - 2013-06-14 05:41 -0500
Re: My son wants me to teach him Python Alister <alister.ware@ntlworld.com> - 2013-06-14 15:35 +0000
Re: My son wants me to teach him Python Neil Cerutti <neilc@norwich.edu> - 2013-06-14 16:01 +0000
Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-15 03:14 +1000
Re: My son wants me to teach him Python Jason Swails <jason.swails@gmail.com> - 2013-06-14 13:03 -0400
Re: My son wants me to teach him Python Jason Swails <jason.swails@gmail.com> - 2013-06-14 02:28 -0400
Re: My son wants me to teach him Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-14 20:12 -0400
csiph-web