[Svnmerge] [PATCH] svnmerge.py: all error handling to be doneusing the error() function

Daniel Rall dlr at collab.net
Fri Mar 31 12:17:32 PST 2006


On Fri, 31 Mar 2006, Madan S. wrote:

> Daniel Rall said:
> > madan said:
> > +def error(s):
> > +    """Subroutine to output an error and bail."""
> > +    print >> sys.stderr, "%s: %s" % (NAME, s)
> > +    sys.exit(1)
> > +
> 
> > > We don't really need to relocate the definition of this function
> > > within the source file.
> 
> I would think so too. But I tried with a sample pythong script. It
> expected the declaration of a function to preceed the
> usage. Wondering what could be different?!


As this is Python (rather than C), that's not required.
<soapbox>Stylistically speaking, when the implementation language
allows it, I prefer definition of high-level code to proceed
lower-level utility routines within a source file (e.g. public stuff
before private stuff), as I feel it results in more easily
understandable code for those who come later (it's top-down,
literally).</soapbox> Also, it avoids spurious diffs in the change
history.  As usual, YMMV.
-- 

Daniel Rall
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/svnmerge/attachments/20060331/48875746/attachment.pgp 


More information about the Svnmerge mailing list