[issue1910] Document that with is slower than try/finally

Raymond Hettinger report at bugs.python.org
Thu Jan 24 05:06:17 CET 2008

Raymond Hettinger added the comment:

Amaury, please do revert 60189.  There is no reason to destabalize this 
code, slow it down, and introduce new dependencies.

Use of the with-statement is not in and of itself a "best practice".  
Where it really shines is in factoring-away repeated setup/teardown 

Modules that serve as elemental building blocks (like threading, Queue, 
heapq, etc) need to have fast, clean code with as few dependencies as 

Also, we should change/modernize something like asyncore or threading 
with a great deal of care and restraint.  It is too easy to introduce 
hard to find bugs in this code.  It took a long time for this code to 
stabalize and we should enjoy the benefits of its maturity.

Tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list