[Python-Dev] Simpler finalization semantics (was Re: PEP 343 - Abstract Block Redux)
Phillip J. Eby
pje at telecommunity.com
Tue May 17 18:02:15 CEST 2005
At 07:17 AM 5/17/2005 -0700, Guido van Rossum wrote:
>The compiler must generate both code paths but one is wasted.
Not if the default behavior is encapsulated in PyResource_Enter()
(returning the object if no __enter__) and PyResource_Exit() (a no-op if no
__exit__). You're going to have to have the branch and test for slot
presence *somewhere*.
>I know this is not a very strong argument,
It's not even an actual argument. :)
>but my gut tells me this
>generalization of the with-statement is wrong, so I'll stick to it
>regardless of the strength of the argument. The real reason will come
>to me.
I don't know about anybody else, but I'd prefer to hear that your gut tells
you it's wrong, because that at least tells me there's no point in
arguing. Pseudo-reasons just make me think there's something to discuss. :)
More information about the Python-Dev
mailing list