Regarding exception handling

Aggelos I. Orfanakos aorfanakos at gmail.com
Sun Jan 30 21:58:10 EST 2005


Good point, but with your way, if "s = ... # socket opens" fails, then
nothing will catch it. What I usually do is what I wrote above (place
it below the 2nd try), and when attempting to close it, first use an if
like: "if locals().has_key('s'):".




More information about the Python-list mailing list