darglint icon indicating copy to clipboard operation
darglint copied to clipboard

DAR301 on empty yield

Open Dreamsorcerer opened this issue 5 years ago • 2 comments

With a plain yield in a function, I get DAR301. Should it ignore this, when there is no value being yielded?

Dreamsorcerer avatar Jun 02 '20 21:06 Dreamsorcerer

I can see the argument for ignoring it, since it should do the same for a plain return statement. And if the yielded value isn't expected to be used, it doesn't need to be documented.

I honestly never imagined a use case for a plain yield. Are you updating shared state and using the generator to control the flow?

terrencepreilly avatar Jun 03 '20 04:06 terrencepreilly

See: https://docs.aiohttp.org/en/stable/web_advanced.html#cleanup-context

The yield is basically just a break point between setting something up and cleaning it up when finished.

Dreamsorcerer avatar Jun 03 '20 09:06 Dreamsorcerer