[Python-ideas] A couple of with statement ideas
Tal Einat
taleinat at gmail.com
Sun Feb 27 23:36:59 CET 2011
Greg Ewing wrote:
> From: Nick Coghlan
> > It's at least a much larger set than it was back when AMK noticed the
> > deep terminology confusion in the first version of the with statement
> > and context management documentation (which was when Guido applied the
> > Zen and dropped the __context__ method from the protocol).
>
> I'm in favour of the idea, but the terminology problem still
> needs to be solved. I think it's important that the name of the
> object implementing this protocol not have the word "context" in
> it *anywhere*.
>
> I like __with__ as the special method name, as it very obviously
> suggests a tight connection with the with-statement.
>
> The only term I can think of right now for the object is
> "withable object". It's a severe abuse of the English language,
> I know, but unfortunately there doesn't seem to be a concise
> verb meaning "enter a temporary execution context".
>
"Inquisitionize"? It's even Pythonic! ;)
Unless I misunderstood, this (__with__ or whatever it ends up being called)
would be an alternate method of implementing a context manager, so why not
just call these "context managers" just like objects with __enter__ and
__exit__ are?
- Tal Einat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110228/9bcee263/attachment.html>
More information about the Python-ideas
mailing list