[Python-Dev] Context management patterns (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Sat Oct 19 13:21:24 CEST 2013


On 19 October 2013 20:47, Glenn Linderman <v+python at g.nevcal.com> wrote:

Thanks again for sharing the big picture: you have before, but I see you've evolved it slightly. Delayed error handling I've had occasion to do, but not yet in Python. The constrained jump pattern is interesting, but the example is not complex enough to justify the syntax: the with solution is actually longer... if you initialized result they'd be the same length. The problem with the for/else construct is that the "not found" case falls through to the "found" case, which can be awkward, but that awkwardness isn't really demonstrated in the example. "exitlabel" is an awkward name, too, since there are no labels, and no exit(). (yes, I know you meant exit the loop; naming is hard.)

You exit with statements - that's why the final method is called exit.

Cheers, Nick.

-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia



More information about the Python-Dev mailing list