Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23247

How to configure a linter (e.g. Ruff) to disallow double assignments in single lines in Python?

$
0
0

I'm looking for a way to configure a linter (such as Ruff or another popular Python linter) to disallow double assignments in single lines, like this:

name, position = files.name, pos

Instead, I want the linter to enforce separate assignments on separate lines, like this:

name = files.nameposition = pos

However, I still want to allow tuple unpacking, like this:

name, position = extract_details()

Is there a way to configure a linter to achieve this behavior? If so, how can I do it?


Viewing all articles
Browse latest Browse all 23247

Trending Articles