9 Dec
2007
9 Dec
'07
5:39 a.m.
Manuel Alejandro CerĂ³n Estrada wrote:
Acording to PEP 255:
Note that return isn't always equivalent to raising StopIteration: the difference lies in how enclosing try/except constructs are treated.
All that means is that def g(): try: if 0: yield return except StopIteration: print "Spam" won't print "Spam". But since this involves catching the exception with an explicit try-except, it doesn't fall under the scope of your complaint.
Of curse, the problem of low level details it's solved by 'yield break'
I would put it the other way around -- the problem that 'yield break' is meant to solve is already solved by 'return'. So there's no need for change. -- Greg