Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive of uncessary-comprehension when repacking tuple members with extra element #3148

Closed
vinzd opened this issue Sep 30, 2019 · 1 comment

Comments

@vinzd
Copy link

vinzd commented Sep 30, 2019

Steps to reproduce

my_list = [(1, 2), (3, 4)]
new_list = [(low, end, None) for low, end in my_list]

Please notice that the issue is not reproduced with the following example:

my_list = [(1, 2), (3, 4)]
my_var = None
new_list = [(low, end, my_var) for low, end in my_list]

Current behavior

************* Module example
example.py:2: [R1721(unnecessary-comprehension), ] Unnecessary use of a comprehension

Expected behavior

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

pylint --version output

pylint 2.4.2
astroid 2.3.1
Python 3.7.4 (default, Jul 16 2019, 07:12:58) 
[GCC 9.1.0]
@RemiCardona
Copy link
Contributor

[(x, y, 1) for x, y in iterable]

Adding the above snippet to tests/functional/u/unnecessary_comprehension.py reproduces the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants