This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hniksic
Recipients eric.araujo, hniksic, michael.foord, ncoghlan, pitrou, vstinner
Date 2010-10-08.12:04:37
SpamBayes Score 0.0001426452
Marked as misclassified No
Message-id <1286539479.65.0.17583535299.issue10049@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-10-08 12:04:39hniksicsetrecipients: + hniksic, ncoghlan, pitrou, vstinner, eric.araujo, michael.foord
2010-10-08 12:04:39hniksicsetmessageid: <1286539479.65.0.17583535299.issue10049@psf.upfronthosting.co.za>
2010-10-08 12:04:38hniksiclinkissue10049 messages
2010-10-08 12:04:37hniksiccreate