pylint-errors

W1506 (bad-thread-instantiation)

:x: Problematic code:

import threading


def thread_target(n):
    print(n ** 2)


thread = threading.Thread(thread_target, args=(10,))
thread.start()

:heavy_check_mark: Correct code:

import threading


def thread_target(n):
    print(n ** 2)


thread = threading.Thread(target=thread_target, args=(10,))
thread.start()

Rationale:

The warning is emitted when a threading.Thread class is instantiated without the target function being passed. By default, the first parameter is the group param, not the target param.