[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: David James <djames_at_collab.net>
Date: 2006-03-31 22:25:54 CEST

On 3/31/06, Madan U S <madan@collab.net> 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?!

In Python, functions must be declared before they are called. If your
"main" function is only called at the bottom of the program, then you
can call any function in the program from the main function. For
example:
   def main():
      hello()
   def hello():
     print "hello"
   main()

If you move the call to "main()" up above the declaration of "hello",
then the program does not work. This is the difference.

Cheers,

David

--
David James -- http://www.cs.toronto.edu/~james
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 31 22:28:45 2006

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.