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

Walter Dörwald walter@livinglogic.de
Mon, 03 Feb 2003 14:35:50 +0100


holger krekel wrote:

 > [...]
> you probably missed my other posting where i actually went
> one step further and implemented this via <...> syntax.

I saw it. I actually took a look at your IEXEC patch, where this
XML stuff is one of your use cases.

Compared to the patch, which uses 
sys._getframe(1).f_locals['__icontent__'] to get at the content
nodes I like the __catch__ idea much better. But I find your
syntax to be too unpythonic.

> Actually i tried *exactly* the syntax you propose here first but
> i think it's *hopelessly* ambigous with the Python grammar. 
>
> You simple have no way to know which construct you are in
> until you read the ':'.  Until then you could be in a
> normal expression.  The 'class', 'def', 'if', 'while' etc.
> keywords disambiguate this right at the beginning.
> 
> Without a much deeper parser look-ahead this can't 
> be done, i am afraid.

You're right, but my point is that in this XML case the new
block feature is used so often that an additional keyword
might be too much typing overhead.

Bye,
    Walter Dörwald