[Python-Dev] 'With' context documentation draft (was Re: Terminology for PEP 343

M.-A. Lemburg mal at egenix.com
Fri Jul 15 11:45:53 CEST 2005


Raymond Hettinger wrote:
> {MAL]
> 
>>This is exactly what I'm getting at: I can see the potential
>>use for resource management (which is what started out the
>>whole idea IIRC), but fail to see why you'd want to use it
>>for anything more complicated than that.
> 
> 
> Substitute "different" for "complicated".
> 
> 'with' is not application specific, it is incredibly general.  All it
> does is abstract recurring uses of try/finally.
> 
> Naming it after a specific class of applications would be a mistake.

Exactly. Which is why "context manager" is IMHO the wrong description.

Calling it "block object" or "with object" or even "try-finally object"
would be more in line with the PEP without causing associations which
might lead to misunderstandings.

Please remember that you have to explain all these things to new
Python users. Over the last few years there have been tons of
new additions to the language - while some will probably disagree,
the learning curve for novices has gotten a lot steeper compared
to the pre-2.0 days when there was much resistance to adding new
features.

Nowadays, for a new programmer to get up and running
with the language and to start working on existing code, you have
to teach them about generators, iterators, decorators, the with
statement - since programs are starting to use these features
actively. More and more program logic gets hidden by the way of
introducing new objects and protocols.

If you then start using terms in the documentation that cause
wrong associations, you make life harder for new programmers.

Anyway, I think I've made my point.

Cheers,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jul 15 2005)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Python-Dev mailing list