Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python curious behavior
#3
(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.
Reply


Messages In This Thread
Python curious behavior - by scidam - Jul-23-2019, 05:16 AM
RE: Python curious behavior - by DeaD_EyE - Jul-23-2019, 07:09 AM
RE: Python curious behavior - by scidam - Jul-23-2019, 11:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation Python 3.10.1 32 Windows setup Virus behavior SapG20211215 8 3,273 Dec-15-2021, 06:51 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020