assignment-from-no-return / E1111ΒΆ

Message emitted:

Assigning result of a function call, but %r returns None%s

Description:

Used when an assignment is done on a function call but the inferred function doesn't return anything.

Problematic code:

function_without_return.py:

def add(x, y):
    print(x + y)


value = add(10, 10)  # [assignment-from-no-return]

in_place_method.py:

fruits = ["orange", "apple", "pear"]
reversed_fruits = fruits.reverse()  # [assignment-from-no-return]

Correct code:

function_without_return.py:

def add(x, y):
    return x + y


value = add(10, 10)

in_place_method.py:

fruits = ["orange", "apple", "pear"]
reversed_fruits = list(reversed(fruits))

Created by the typecheck checker.