
Thomas Grainger writes:
Right but it's not a status code - it's a callback that you *must* call
OK. Thing is, Serhiy was just saying "hey I did almost exactly that (but minor technical detail)". In your idiomatic usage, 'exit' is almost invisible outside of the wrapped context manager. I don't see why anybody would care what order it's returned in Python (there might be some argument in Lisp where multiple values return requires a special API, but the primary value can be accessed as an ordinary return value).
I guess instead of "return first what's needed, then what's wanted", you could define it "return first the items needed elsewhere in that API, then items you don't know what the user plans to do with them." That would be a rule people could follow (and I certainly would not have replied at all :-).