subversion@millenix.mailshell.com writes:
> David Summers wrote:
> > * gen-make.py : Fix issue with Python 1.5.2 compatability.
> > Index: gen-make.py
> > ===================================================================
> > --- gen-make.py (revision 8372)
> > +++ gen-make.py (working copy)
> > @@ -156,9 +156,9 @@
> > # Remember all options so other scripts can use them
> > opt_conf = open('gen-make.opts', 'w')
> > - print >> opt_conf, "[options]"
> > + opt_conf.write( '[options]' )
> > for opt, val in rest.list:
> > - print >> opt_conf, opt, '=', val
> > + opt_conf.writeline( opt, '=', val )
> > opt_conf.close()
> > if gentype not in gen_modules.keys():
>
> This patch cannot possibly be correct. To replace a single construct
> ("print >> opt_conf"), you use 2 different new constructs,
> opt_conf.write() and opt_conf.writeline(). Which is it?
> Perhaps someone with python experience can clear this up.
Careful throwing around words like "cannot possibly" :-). The patch
is not correct, but not for the reasons you imply. See
http://www.python.org/doc/1.5.2p2/lib/typesother.html#l2h-69
Summary: write() writes one string to the file, writelines() takes a
list of strings.
There are bugs here, though. Neither write() nor writelines() has
print's auto-padding behavior, so any spaces and newlines need to be
included explicitly. David, try
opt_conf.write( '[options]\n' )
and
opt_conf.writelines( opt, '=', val, '\n' )
(According to the above web page, it's "writelines" not "writeline".
Did you test your patch?)
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jan 19 17:35:11 2004