Python

Python

Made by DeepSource

init method converted to generator PYL-E0100

Bug risk
Critical

The __init__() method is required to return nothing, but a yield statement in its body was detected. This will raise a TypeError.

Not preferred:

class NotCorrect:
    def __init__(self):
        self.attr = 100
        yield

Preferred:

class Correct:
    def __init__(self):
        self.attr = 100