python reference counting and exceptions

Delaney, Timothy (Tim) tdelaney at avaya.com
Tue Sep 12 20:28:37 EDT 2006


Andreas Huesgen wrote:

> In c++, it is possible to write a locking system similar to the one
> below: 
> 
> 
> void myFunction()
> {
> 	# create a resource lock. Locks some resource
> 	ResourceLock myLock;
> 
> 	# the following line may throw an exception
> 	doStuff();
> }

RIIA - Resource Initialisation is Acquisition

Python is adding an RIIA mechanism in 2.5 - look at the "with"
statement.

Tim Delaney



More information about the Python-list mailing list