Paul Moore wrote: > On 7/6/05, Nick Coghlan <[EMAIL PROTECTED]> wrote: > >>OK, here's some draft documentation using Phillip's context >>terminology. I think it works very well. > > > I agree. +1 on this terminology, and for this explanation to be > included in the docs. > > I also like the fact that it offers a neat 1-word name for the > generator decorator, "@context".
I liked that too, along with 'ContextManager' as the name for the controlling class that had the highly descriptive name 'Wrapper' in PEP 343. And explaining the operation of specific contexts is generally nice too. Stealing Greg's example: decimal.Context supports the context management protocol, and introduces a new decimal arithmetic context for the duration of the with statement. And the synchronisation example: threading.Lock supports the context management protocol, and acquires the lock for the duration of the with statement. And the generic closing example: closing supports the context management protocol, and closes the supplied resource at the end of the with statement. And the HTML tag examples: The HTML tag objects support the context management protocol, and emit opening and closing tags before and after execution of the body of the with statement. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com