[Python-Dev] Suggested addition to PEP 8 for context managers (original) (raw)

Paul Moore p.f.moore at gmail.com
Mon Apr 16 09:13:47 CEST 2012


On 15 April 2012 18:13, Raymond Hettinger <raymond.hettinger at gmail.com> wrote:

We should publish some advice on creating content managers.

Context managers are a general purpose tool but have a primary use case of creating and releasing resources.  This creates an expectation that that is what the context managers are doing unless they explicitly say otherwise.

I'd have said this was unnecessary, but the sqlite example shows it isn't, so +1 from me.

As a database specialist, the sqlite behaviour you show is completely non-intuitive :-(

Paul.



More information about the Python-Dev mailing list