using-comprehension-unpacking-in-unsupported-version / W2607ΒΆ

Message emitted:

Unpacking in comprehensions is not supported by all versions included in the py-version setting

Description:

Used when the py-version set by the user is lower than 3.15 and pylint encounters the ``*`` or ``**`` unpacking added by PEP 798 in a comprehension.

Problematic code:

baskets = [["apple", "banana"], ["cherry"]]
fruits = [*basket for basket in baskets]  # [using-comprehension-unpacking-in-unsupported-version]

Correct code:

baskets = [["apple", "banana"], ["cherry"]]
fruits = [fruit for basket in baskets for fruit in basket]

Configuration file:

[main]
py-version=3.14

Additional details:

Unpacking in comprehensions was introduced in Python 3.15; to use it, please use a more recent version of Python.

Created by the unsupported_version checker.