Jul-23-2019, 11:41 AM
(Jul-23-2019, 07:09 AM)DeaD_EyE Wrote: Return a value via return is different use case and need the try-except clause.May be I something misunderstood, but according to docs this could not be handled via try-except "except that, as currently, the exception cannot be caught by except clauses within the returning generator.".
(Jul-23-2019, 07:09 AM)DeaD_EyE Wrote: No, because the construct is useful.I just told about raising a warning, not an exception. This is only polite way to point user's
attention on using
return
and yield
in the same place. Such warning passed to stdout
would be informative, I think.This warning wouldn't break any existing code.