At 03:04 PM 7/3/2005 +0100, Michael Hudson wrote:
"Phillip J. Eby" firstname.lastname@example.org writes:
At 05:41 PM 6/30/2005 -0400, Raymond Hettinger wrote:
With 343 accepted, we can now add __enter__() and __exit__() methods to objects.
What term should describe those objects in the documentation?
Thing is, there may be no resource; in my talk at EuroPython:
I used a with statement to establish and dis-establish an error handler -- would you call that a resource?
Yes; an error handling resource is no different than say, a decimal context resource in this respect. A "with" statement defines the scope of use or applicability of some resource; the resource manager is the object that is notified as to when the scope is entered and exited, so that it can appropriately manage the resource.
Some resources may be their own default resource manager, but it's always possible to create a different resource management policy by creating a new resource manager.
I think this is a clear and straightforward explanation of what "with" does and what you can do with it.