Re: [PATCH FOR REVIEW] add tests for svn getopt processing
From: Greg Stein <gstein_at_lyra.org>
Date: 2002-04-06 00:20:03 CEST
On Fri, Apr 05, 2002 at 01:38:12PM -0800, Blair Zajac wrote:
You're only referring to the file.close method -- not actually invoking it.
But even simpler:
exp_stdout = open(stdout_filename).readlines()
That opens it ('r' is default), then reads all the lines in one shot. Since
[ note that file.close() wasn't even needed in your function since the files
>...
It would be a lot simpler if you used a tuple in that list:
replace_lines_res = [ (re.compile(...), 'version ...'),
Then you can do:
for replace_re, replace_str in replace_lines_res:
Much clearer...
>...
To change the varargs tuple to a list, use: list(varargs). That is much
> + varargs.insert(0, 1)
Usually, when I need to add an argument like the above, I'll do the
apply(svntest.main.run_svn, (1,) + varargs)
This is clearer about the intent: inserting an argument at the beginning of
> + # Delete and perform search and replaces on the lines from the
Personally, I'd find this clearer if you used one function to post-process
def process_lines(lines):
Then you just do:
exp_stdout = process_lines(exp_stdout)
That makes the calls clearer, reduces the two functions to one, and
Cheers,
-- Greg Stein, http://www.lyra.org/ --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org For additional commands, e-mail: dev-help@subversion.tigris.orgReceived on Sat Apr 6 00:15:55 2002 |
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.