return-arg-in-generator / E0106#

Message emitted:

Return with argument inside generator


Used when a "return" statement with an argument is found outside in a generator function or method (e.g. with some "yield" statements).

Correct code:

def yield_numbers():
    for number in range(10):
        yield number
        return "I am now allowed!"  # This was not allowed in Python 3.3 and earlier.

Created by the basic checker.