Pop return from stack?

John Nagle nagle at animats.com
Sun Aug 15 15:52:06 EDT 2010


On 8/14/2010 4:05 PM, bvdp wrote:
> Assuming I have a module 'foo.py' with something like this:
>
> def error(s):
>      print "Error", s
>      sys.exit(1)
>
> def func(s):
>      ... do some processing
>      ... call error() if bad .. go to system exit.
>      ...  more processing

    Fix "func".  That's terrible Python.   No standard Python library
module calls system exit to handle an error.  So that must be in
your code.   Standard procedure for errors is to raise an
exception.
			
				John Nagle



More information about the Python-list mailing list