[Python-Dev] Terminology for PEP 343

Ron Adam rrr at ronadam.com
Sun Jul 3 20:02:21 CEST 2005


Nick Coghlan wrote:

> On the other hand 'enter and exit' rolls off the tongue
> significantly better than 'enter and leave'

My only concern is enter and exit may be too general.  They are
frequently used in other places, although __enter__ and __exit__ are
less common, so maybe it's a non issue.

The terms __begin__ and __end__, are nearly as general, but they stress
better that there are three parts, a beginning, middle and ending.


> All of which just leads me to the conclusion that English is a screwy
> language, and I already knew that ;)

I nowe that tue, but fixxing it issint backward compattibbal. ;-)


> Anyway, I stuck with 'exit' for this - I prefer slightly awkard 
> phrasing in the explanation to awkwardness in the pairing of the names.


After reading Michael Hudsun's post:

>>I used a with statement to establish and dis-establish an error
>>handler -- would you call that a resource?

He has a good point, maybe we are confusing what a with-block does, with
how it can be used.

So something along the lines of ...

"""
With-Mangager Blocks

A With-Manager Block is used to combine related initiation and
finalization routines from a Manager object with a local block of code.
Python will attempt to execute the finalization routine even if an error
occurs which makes With-Manager Blocks useful for writing algorithms
which require dependable closure or release of an acquired resource
after the code block is executed.

etc... """


That's a nice start on the docs Nick.

Cheers,
Ron





More information about the Python-Dev mailing list