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 on E1101 when combining str.join with += operator #2911

Closed
themiurge opened this issue May 10, 2019 · 0 comments
Closed

False positive on E1101 when combining str.join with += operator #2911

themiurge opened this issue May 10, 2019 · 0 comments

Comments

@themiurge
Copy link

Steps to reproduce

  1. Run pylint on the following code snippet:
from collections import namedtuple

SomeClass = namedtuple('SomeClass', ['name'])

items = [SomeClass(name='some name')]

some_str = 'Items:\n'
some_str += ', '.join(item.name for item in items)

Current behavior

The some_str += ... line gets flagged as:

E1101: Instance of 'str' has no 'name' member (no-member)

The following (i.e. removing the += operator) works fine:

...
some_str = some_str + ', '.join(item.name for item in items)

The following also works fine:

...
item_names = (item.name for item in items)
some_str = 'Items:\n'
some_str += ', '.join(item_names)

Expected behavior

No error.

pylint --version output

pylint 2.3.1
astroid 2.2.5
Python 3.5.2 (default, Nov 12 2018, 13:43:14) 
[GCC 5.4.0 20160609]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants