Skip to content

STYLE enable pylint: use-implicit-booleaness-not-comparison #49654

New issue

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

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

Already on GitHub? # to your account

Conversation

natmokval
Copy link
Contributor

Issue #48855. This PR enables pylint type "C" warning: use-implicit-booleaness-not-comparison

Note: Pylint at the moment raises the following error on clean main branch

************* Module pandas._libs.tslibs
pandas/_libs/tslibs/__init__.py:38:0: W0406: Module import itself (import-self)

@MarcoGorelli
Copy link
Member

Thanks @natmokval for working on this one

Are we sure this one's safe? E.g.

a: list | None

a = None

if a == []:
    print('here')

doesn't print anything, but changing it to

a: list | None

a = None

if not a:
    print('here')

prints 'here'

Perhaps we should keep this one turned off, just like use-implicit-booleaness-not-len?

@natmokval
Copy link
Contributor Author

Thanks, @MarcoGorelli, you are right. I checked the behavior only in a subset of the cases. It is cleaner to keep this check turned off.

@MarcoGorelli
Copy link
Member

cool, thanks - closing for now then, and sorry that you already did work on this!

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

Successfully merging this pull request may close these issues.

2 participants