A little disappointed so far

Brian Quinlan brian at sweetapp.com
Sun May 18 22:46:15 EDT 2003


> BTW,
> open ($file) || die "Couldn't open $file"
> strikes me as rather readable. And concise.

In Python, just write:
f = open(file)

If there is an exception, an error message will be generated explaining
why the file could not be opened and your script will terminate.

The problem with your Perl code is that it doesn't really help with
problem diagnosis i.e. does the file not exist, is it a directory, do I
not have the necessary permissions, etc.

Cheers,
Brian






More information about the Python-list mailing list