yield syntax (diverging from: How would shallow generators compose with lambda?)
nmix at pandora.com
Mon May 18 11:53:12 PDT 2009
> Nothing prevents you from writing yield(E) of course -- but you're
> arguing that foo(a = yield(b), c) should be enough, no extra parens
> required -- no foo(a = (yield(b)), c). Right?
Yes that's correct.
>> Pros for yield(E):
>> - backward compatible
> But for this to be true, we would need to use the direct-eval
> detection hack I mentioned previously.
On the plus side, this would allow for feature detection of generator
support, right? (Is there any other way to detect generator support?)
>> - easier to read (to my eye)
>> - it "feels" more correct to me in context of the when-using-send-
>> value rule
> These are subjective enough there's no point in arguing. I hear ya.
Yes, one man's opinion and experience. If others chimed in claiming
the opposite experience, obviously my argument would be moot. But I
hope I'm providing a decent "average hacker" POV for you.
>> Pros for (yield E):
>> - consistent with python
>> - doesn't present any is-it-a-function? ambiguities
> These are more objective (no look & feel ;-). There is a borrowing
> from Python. There isn't a function call going on.
Agreed. If look-and-feel weren't factors, I wouldn't have brought it
More information about the es-discuss