[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Daniel Rall <dlr_at_collab.net>
Date: 2006-03-31 22:17:32 CEST

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

  • application/pgp-signature attachment: stored
Received on Fri Mar 31 22:20:16 2006

This is an archived mail posted to the Subversion Dev mailing list.