Chris Angelico wrote:
Possible alternate syntax:transfer func[, (arg1, arg2, arg3)[, {'kw1': val1, 'kw2': val2}]] This makes it very clear that this is NOT accepting an arbitrary expression, but MUST be used with a single function and its arguments. Downside: It doesn't look like a function call any more. Upside: It's easy to parse.
Personally I'd be fine with your initial syntax, but something else might be needed to get it past Guido. He didn't like my 'cocall f()' construct in PEP 3152, which is syntactically isomorphic to 'transfer f()'.
Is there anything that I've missed out in speccing this up? I've a suspicion that this might turn out to be as complicated as 'yield from' in all its handling of edge cases.
Presumably it would only work on functions implemented in Python? It's no use discarding the Python stack frame unless the C recursion in the ceval loop can be avoided as well.
Current candidates: "transfer", "goto", "recurse", and anything else you suggest.
Another possibility is "chain", which I've seen in some contexts for an sh exec-like operation. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
