[Python-Dev] capturing RETURN_VALUE (original) (raw)

Christian Tismer tismer at stackless.com
Mon Aug 9 11:16:52 CEST 2004


Tim Peters wrote:

...

The point was that exceptions and returns act the same way: RETURNVALUE isn't unique here, it's just another instance of leaving a try-block's suite, the same in this respect as an exception or a break statement. That's why it's reliable over time: it's a general mechanism at work, not an arbitrary hack specific to RETURNVALUE.

Yes, that was special for me: That return is not special. I should have known because I know the implementation so very well, but I always felt that return is something final. Maybe it would make sense to add a few sentences about this fact somewhere (where?) in the docs; It was quite remarkable for me.

Actually, there is nothing final in Python: It is not possible to deduce from an inner code block whether it will be able to finish the enclosing function, unless you know that your code block consumes 20 block levels (and the latter is probably a much less reliable fact. :-)

return-finally-break - ly y'rs -- chris

Christian Tismer :^) <mailto:tismer at stackless.com> Mission Impossible 5oftware : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9a : Starship http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/



More information about the Python-Dev mailing list