"Bryan" wrote

> the above is not the same. make the a = ... raise an exception and you'll see 
> the difference.
>
> s = ... #
> a = 1/0
> s.close()
>
> as you can see, s.close() will never be called.  also, in this example, i 
> intentionally didn't put 
> the extra try/except around the try/finally statement.

file handles and sockets are closed when the objects are garbage collected.
under CPython, they're usually closed when they go out of scope.

using try/finally on files and sockets are usually overkill.

</F> 



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

Reply via email to