On Mon, Oct 31, 2011 at 12:15 PM, Brian Curtin <brian.cur...@gmail.com> wrote:
>
> You'd just add "__enter__" and "__exit__" in the PyMethodDef. If you
> have the CPython source, we do it in there in a few places. Off the
> top of my head, PC\winreg.c contains at least one class that works as
> a context manager (PyHKEY), although there are a few others scattered
> around the source.
>

That is what I figured. I was just hoping there was some helper class
similar to the contextmanager decorator that would make it easier to
use, however at the same time it makes sense that there is not.

Thanks,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to