Stephen R Laniel <[EMAIL PROTECTED]> writes: > Perhaps it would help for me to explain what I'd like.
Thanks for taking the time to think about the request and re-formulate it. > Under both Perl and Python, I've found myself > having/wanting to write things like so: > > def my_func( int_arg, str_arg ): > try: > int_arg = int( int_arg ) > str_arg = str( str_arg ) > except ValueError: > sys.stderr.write( "Args are not of the right type\n" ) > sys.exit(1) The first question that comes to mind -- and you'll find this question asked of hundreds of people who come to this list with similar stated goals -- is this: Why are you doing the above? In Python, the pattern is to allow that exception to propagate back to the code that tried to use the function, which is the one that is apparently using the function incorrectly. That is, you haven't actually told us what you'd like. You've shown us a function that effectively does nothing but create a str and and int -- and then discard them. What does this function need to do that you want to catch an exception and abort inside the function? -- \ "It is well to remember that the entire universe, with one | `\ trifling exception, is composed of others." -- John Andrew | _o__) Holmes | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list