You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Karl Fogel <kf...@newton.ch.collab.net> on 2003/04/29 21:22:20 UTC
Re: svn commit: rev 5762 - branches/cvs2svn-kfogel/tools/cvs2svn
Greg Stein <gs...@lyra.org> writes:
> Style-nit-alert: rather than a bunch of .write() calls, I tend to do:
>
> self.dumpfile.write('K 14\n'
> 'svn:executable\n'
> 'V 1\n'
> '*\n')
>
> The standard string pasting makes that work quite well, and the parens let
> the newlines slide right in without a hassle.
Ah, just what I was looking for, thanks.
> > + # The content length is the length of property data, text data,
> > + # and any metadata around/inside around them.
> > + self.dumpfile.write(string.rjust(str(length + props_len), 16))
>
> I've never been clear why string.rjust exists. You can just do:
>
> self.dumpfile.write('%16d' % (length + props_len))
That'd be simpler, will do. It's what I would have done in C... Maybe
I instinctively avoided it in Python or something :-).
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: rev 5762 - branches/cvs2svn-kfogel/tools/cvs2svn
Posted by Greg Stein <gs...@lyra.org>.
On Tue, Apr 29, 2003 at 04:22:20PM -0500, Karl Fogel wrote:
> Greg Stein <gs...@lyra.org> writes:
>...
> > I've never been clear why string.rjust exists. You can just do:
> >
> > self.dumpfile.write('%16d' % (length + props_len))
>
> That'd be simpler, will do. It's what I would have done in C... Maybe
> I instinctively avoided it in Python or something :-).
hehe... most likely, just unsure whether it works as you'd like. Before
posting, I actually double-checked the string.rjust() vs the % operator in
an interactive Python session.
Those interactive sessions are da bom... :-)
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org