[Python-Dev] Acquire/release functionality (Was: Extended Function syntax)

Alex Martelli aleax@aleax.it
Sun, 2 Feb 2003 23:01:32 +0100


On Sunday 02 February 2003 10:49 pm, Paul Moore wrote:
   ...
> which I've been referring to as acquire/release. The only
> property-like cases I'm aware of are properties themselves.

Wouldn't classmethods and staticmethods also be able to
exploit (in a simpler way) the syntax/semantics used for
properties?  That's the impression I had.

I do like your "unified proposal" for the "with" case (I have
no idea if "with" is the pluperfectly right sugar for this, btw --
no biggie anyway, i think).

> the exception should be propogated. The problem is that I'm not sure
> what is the best way for an __except__ method to signal that it caught
> the exception.

Maybe the return value of __except__ should be evaluated in a boolean
context encoding this?  False -> exception not caught, True -> caught ...  

So, an __except__ without return statements (implicitly returning None,
thus false) would be a clean-up thingy that does no catching (but e.g.
just rollbacks some DB transactions or whatever), for example -- a
"return True" would explicitly signal the exception was caught -- etc.


Alex