Python equivalent to Perl's warn/confess/die

Paul Prescod paul at prescod.net
Fri May 26 14:16:37 EDT 2000


sys.stderr.write *is* the warn function. sys.stderr can be any object
including a new one you write to email error messages to a factory where
they manufacture custom t-shirts with witty messages like "%s records
read". I know that Perl warn has a few more features but you can emulate
most of them by overwriting sys.stderr.

"die" is an exception mechanism so I would argue that that is somewhat
separate.

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
Just how compassionate can a Republican get before he has to leave the 
GOP and join Vegans for Global Justice? ... One moment, George W. Bush
is holding a get-to-know-you meeting with a bunch of gay Republicans.
The next he is holding forth on education or the environment ... It is
enough to make a red-blooded conservative choke on his spotted-owl
drumstick.     - April 29th, Economist




More information about the Python-list mailing list