On Sat, Oct 29, 2011 at 8:51 PM, Paul Moore email@example.com wrote:
I think that if the runtime support can be built in a way that allows a Lua-style function/method approach, then that should be the initial design, as it's easier to tweak a functional API than to change syntax. If experience shows that code would benefit from syntax support, add that later.
I have one specific reason I think the new yield variant should get a new keyword: it's a new kind of flow control, and Python has a history of trying to keep flow control explicit (cf. the PEP 343 with statement discussions).
At the *call* level, it wouldn't need a keyword, since cocall(x) could just be a wrapper around x.__cocall__().
This would be similar to the situation with generators - yielding from a generator has dedicated syntax (in the form of 'yield'), but invoking one just uses the standard call and iterator syntax.