mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 22:55:08 +00:00
17 lines
No EOL
344 B
Markdown
17 lines
No EOL
344 B
Markdown
# yield-in-init (PLE0100)
|
|
|
|
Derived from the **Pylint** linter.
|
|
|
|
### What it does
|
|
Checks for `__init__` methods that turned into generators
|
|
via the presence of `yield` or `yield from` statements.
|
|
|
|
### Why is this bad?
|
|
Generators are not allowed in `__init__` methods.
|
|
|
|
### Example
|
|
```python
|
|
class Foo:
|
|
def __init__(self):
|
|
yield 1
|
|
``` |