Hrvoje Nikšić <hnik...@gmail.com> added the comment:

That is what we are using now, but I think a contextlib.null() would be useful 
to others, i.e. that its use is a useful idiom to adopt.  Specifically I would 
like to discourage the "duplicated code" idiom from the report, which I've seen 
all too often.

The "closing" constructor is also trivial to define, but it's there for 
convenience and to promote the use of with statement over try/finally 
boilerplate.  The same goes here: you don't miss the null context manager when 
you don't have it; you invent other solutions.  But when it's already 
available, it's an elegant pattern.  In my experience, if they have to define 
it to get it, most people won't bother with the pattern and will retain less 
elegant solutions.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10049>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to