[Tutor] Python equiv of Perl's 'or die()' syntax

Ben Beuchler insyte@emt-p.org
Wed, 19 Jul 2000 17:53:23 -0500


On Wed, Jul 19, 2000 at 03:37:27PM -0700, Deirdre Saoirse wrote:

> > Is there a simple equivalent to Perl's 'or die()' syntax?
> > 
> > Similar to this:
> > 
> > open( MYFILE, 'filethatdoesnotexist') or die "Help me!!:$!"
> 
> sure:
> 
> def die(printme):
>  print printme
>  exit(1)
> 
> :)

Heh... Very nice.  Now if I could get that gosh-darn "do something or
die()" working...

8-)

Gracias,
Ben

-- 
Ben Beuchler                                         insyte@bitstream.net
MAILER-DAEMON                                         (612)-321-9290 x101
Bitstream Underground                                   www.bitstream.net