Christopher Subich wrote:

> try:
>     f=file('file_here')
> except IOError: #File doesn't exist
>     error_handle
>     error_flag = 1
> if not error_flag:
>     do_setup_code
>     do_stuff_with(f)
> 
> which nests on weird, arbitrary error flags, and doesn't seem like good
> programming to me.

Neither does it to me. What about

try:
    f=file('file_here')
except IOError: #File doesn't exist
    error_handle
else:
    do_setup_code
    do_stuff_with(f)

(Not that I'd want to defend Joel's article, mind you...)

-- 
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to