How to tell if I can open a file or not
Gordon McMillan
gmcm at hypernet.com
Thu Jun 8 21:59:47 EDT 2000
Donn Cave wrote:
>One reason it's better than the C way: sooner or later, you will check
>whether a file can be opened, go ahead to open it on the strength of
>this check, and find that it can't be opened anyway. Your program
>crashes, the air traffic control system goes out to lunch and hundreds
>die.
>
>After you check, there's a period of time before you actually open
>the file. It's a brief window, but it's real, and many things can
>happen in that time if the system is busy, including changes to the
>file's permission bits or even whether it exists. Might as well
>just open the file, and if it works then you have a green light.
And hundreds of people die, anyway.
God-am-I-glad-I'm-off-air-traffic-control-ly y'rs
- Gordon
More information about the Python-list
mailing list