At 12:49 PM 4/24/2006 -0700, Aahz wrote: >On Mon, Apr 24, 2006, Phillip J. Eby wrote: > > At 12:24 PM 4/24/2006 -0700, Aahz wrote: > >>On Mon, Apr 24, 2006, Phillip J. Eby wrote: > >>> At 04:48 AM 4/25/2006 +1000, Nick Coghlan wrote: > >>>> > >>>>Using two names to describe three different things isn't intuitive for > >>>>anybody. > >>> > >>> Um, what three things? I only count two: > >>> > >>> 1. Objects with __context__ > >>> 2. Objects with __enter__ and __exit__ > >>> > >>> What's the third thing? > >> > >>The actual context that's used during the execution of BLOCK. It does > >>not exist as a concrete object, > > > > Um, huh? It's a thing but it's not an object? I'm lost now. I don't see > > why we should introduce a concept that has no concrete existence into > > something that's hard enough to explain when you stick to the objects that > > actually exist. :) > >Let's go back to a pseudo-coded with statement: > > with EXPRESSION [as NAME]: > BLOCK > >What happens while BLOCK is being executed? Again, here's what I said >originally: > > EXPRESSION returns a value that the with statement uses to create a > context (a special kind of namespace). The context is used to > execute the BLOCK. The block might end normally, get terminated by > a break or return, or raise an exception. No matter which of those > things happens, the context contains code to clean up after the > block. > >Do you have an alternate proposal for describing this that works well for >newbies?
No, I like your phrasing -- but it's quite concrete. EXPRESSION returns a value (object w/__context__) used to create a context (object w/__enter__ and __exit__). That's only two things. There is no *third* thing here. _______________________________________________ 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