>In your example when would isinstance(__exit_context__, ReturnContext)
>be True and when would it be False? What would __exit_context__.value
>be? I can't think of a sensible meaning for it. If no exception occurs,
>is the value returned by f supposed to be 10/x or __exit_context__.value
>+ 1
>def f(x):
> try:
> quot = 10 / x
> except ZeroDivisionError as exc:
> log_error(exc)
> return 0
> else:
> log_return(quot)
> return quot + 1
> finally:
> "Any cleanup processing needed before returning"
This involves defining the new
Dear mailing list,
there is currently no direct way to observe the current interpreter state in a
finally block without tracing.
My idea is introducing an immutable __exit_context__ magic variable, which
would have one of three possible values:
* ReturnContext(value), if a return statement is