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.11:52:02
SpamBayes Score 2.22441e-08
Marked as misclassified No
Message-id <>
Thank you for your comments.

@Michael: I will of course write tests and documentation if there is indication that the feature will be accepted for stdlib.

@Antoine: it is true that a null context manager can be easily defined, but it does requires a separate generator definition, often repeated in different modules.  This is markedly less elegant than just using contextlib.null() in an expression.

I'm not acquainted with the history of identity function requests, but note that the identity function can be defined as an expression, using simply lambda x: x.  The equivalent expression that evaluates to a null context manager is markedly more convoluted, as shown in my report.

@Éric: The Null/_null/null distinction is an optimization that avoids creating new objects for something that is effectively a singleton.  It would be perfectly reasonable to define contextlib.null as Antoine did, but, this being stdlib, I wanted the implementation to be as efficient as (reasonably) possible.
Date User Action Args
2010-10-08 11:52:04hniksicsetrecipients: + hniksic, ncoghlan, pitrou, vstinner, eric.araujo, michael.foord
2010-10-08 11:52:04hniksicsetmessageid: <>
2010-10-08 11:52:03hniksiclinkissue10049 messages
2010-10-08 11:52:02hniksiccreate