[Tutor] finally without try or except

Brett Ritter swiftone at swiftone.org
Mon Jul 30 21:35:26 CEST 2012


On Mon, Jul 30, 2012 at 12:20 PM, Tino Dai <oberoc at gmail.com> wrote:
> Yes, but that would involve surrounding the entire method with a try except
> finally block. I was
> told by the Python-Guru-In Residence that shouldn't emulate Java code in
> Python, and that was
> generally bad programming practice (no flame war intended)

It is true that you should use the idioms of each language in their
domain.  That doesn't mean you should ignore language features
entirely.  Wrapping everything in a single try/finally to handle this
exception is as intended and not emulating the Java style of wrapping
everything everywhere (be that good or bad).

-- 
Brett Ritter / SwiftOne
swiftone at swiftone.org


More information about the Tutor mailing list