Avoid "is" and "is not" for literal comparisons#101
Merged
adriank merged 1 commit intoadriank:masterfrom Aug 12, 2020
turettn:is_literal_warnings
Merged
Avoid "is" and "is not" for literal comparisons#101adriank merged 1 commit intoadriank:masterfrom turettn:is_literal_warnings
adriank merged 1 commit intoadriank:masterfrom
turettn:is_literal_warnings
Conversation
Starting with python 3.8, using `is` or `is not` to compare with a literal throws a SyntaxWarning. All the details can be found here: https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/ This commit replaces the identity check with an equality check.
Owner
|
In 2010 is meant == plus type check if I remember correctly. Do you know
when python changed it to identity check?
Adrian
On Wed, 12 Aug 2020 at 21:44 Coveralls ***@***.***> wrote:
[image: Coverage Status] <https://coveralls.io/builds/32713953>
Coverage remained the same at 89.557% when pulling *0230180
<0230180>
on turettn:is_literal_warnings* into *445744a
<445744a>
on adriank:master*.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABLE4SKBJPTXYGMX3JWXTTSALWIPANCNFSM4P5GCMFA>
.
--
Greetings,
Adrian Kalbarczyk
https://kalbarczyk.co | https://devyard.io
|
Contributor
Author
|
This seems to go back to at least Python 2.0: Depending on your implementation of python, |
|
@adriank Any chance to have this fix as a new version? |
Owner
|
This PR was merged almost a year ago. Have you found other occurrences of is/is not in the code? |
I am using |
|
@adriank Could you release a new version on PyPI that contains this change? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Starting with python 3.8, using
isoris notto compare with a literal throws a SyntaxWarning.All the details can be found here:
https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/
This commit replaces the identity check with an equality check.