On Sat, Nov 21, 2026, at 9:59 PM, Larry Garfield wrote:

>> the returned value from `file_for_write` isn't used and should trigger a
>> warning.
>
> That seems reasonable; I'll have to confirm with Arnaud that we can 
> implement that.
>
>> 6. Is there a way for the generator to specify that the *yielded value* 
>> should
>> not be discarded? The current RFC text says
>>
>>> If no VAR is specified, the yielded value is ignored.
>>
>> and while `NoDiscard` would highlight the ignoring for a function return, it
>> doesn't for generator yields.

Update here: this is actually not feasible for either the return or yield, 
because right now, generators don't do that.  A #[NoDiscard] on a generator 
function means "don't discard the generator object," and says nothing about the 
return or yield.  Changing that means changing the behavior of NoDiscard, which 
is out of scope, and would also impact performance.

I've added a note to Rejected Features on this front.

--Larry Garfield

Reply via email to