Guido van Rossum wrote: > That +0 could turn into a +1 if there was a way to flag this as an > error (at runtime), at least if the return is actually executed: > > def g(): > yield 42 > return 43 > > for x in g(): > print x # probably expected to print 42 and then 43 > > Perhaps the exception used in this case could be a different exception > than StopIteration? Would checking that the value is None be sufficient? Or do you want to distinguish between 'return' and 'return None'? That would feel rather strange to me. I'm inclined to regard this as an unnecessary complication. People are already trained to think of 'return' and 'yield' as quite different things. I don't know why they would suddenly start using 'return' when they mean 'yield'. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4