[EMAIL PROTECTED] wrote:
> On Jun 21, 9:00 pm, Robert Hicks <[EMAIL PROTECTED]> wrote:
>> Is it good practice to do something like:
>>
>> try:
>> f1 = file('file1')
>> f2 = file('file2')
>> except:
>> # catch the exception
>
> If what you want is to make sure that resources will be rel
Matimus wrote:
> It depends, what are you going to do if there is an exception? If you
> are just going to exit the program, then that works fine. If you are
> going to just skip that file, then the above wont work. If you are
> going to return to some other state in your program, but abort the
> f
On Jun 21, 9:00 pm, Robert Hicks <[EMAIL PROTECTED]> wrote:
> Is it good practice to do something like:
>
> try:
> f1 = file('file1')
> f2 = file('file2')
> except:
> # catch the exception
It's bad practice. Because you use a bare except clause, and don't do
anything useful with the ex
On Jun 21, 3:11 pm, Matimus <[EMAIL PROTECTED]> wrote:
> It depends, what are you going to do if there is an exception? If you
> are just going to exit the program, then that works fine. If you are
> going to just skip that file, then the above wont work. If you are
> going to return to some other
It depends, what are you going to do if there is an exception? If you
are just going to exit the program, then that works fine. If you are
going to just skip that file, then the above wont work. If you are
going to return to some other state in your program, but abort the
file opening, you might wa
Is it good practice to do something like:
try:
f1 = file('file1')
f2 = file('file2')
except:
# catch the exception
Or do you do a try/except for each open?
Robert
--
http://mail.python.org/mailman/listinfo/python-list