[Python-Dev] Terminology for PEP 343

Ron Adam rrr at ronadam.com
Sun Jul 3 04:40:06 CEST 2005


Raymond Hettinger wrote:

> Hmm, that got me to thinking a bit more.  Here's another subjective two
> cents worth.  "exit" seems to be a more global concept and "leave" seems
> more local.  For instance, I leave a room but exit a building.  In
> Python, sys.exit and os._exit are grand exits rather than local exits
> for functions or modules.

Yes, but it's not simply an enter, or an exit.  The most accurate 
association I can think of is "initiate" and "finalize".  They indicate 
a process is being done on the way in and out, where as "enter", "leave" 
and "exit" do not.  But the context might vary depending on what is 
actually being done so it has to remain fairly general.

The words "enter" and "exit" are nice because they are fairly straight 
forward, familiar, and short to type.  But they don't really imply any 
association to the with blocks.  So they may be on the side of being too 
general.

An alternative that has been associated to blocks in other languages is 
"begin" and "end".  So it could be a "Resource Manager Block", which 
uses a "__begin__" and "__end__" method, which is defined in a "Resource 
Manger" object or a "Resource Manager Generator" object, which is called 
by the 'with' key word.

Maybe someone can rephrase that a bit better. :)

Cheers,
Ron



More information about the Python-Dev mailing list