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

fix comparisons to literals #340

Closed
wants to merge 1 commit into from

Conversation

guidopetri
Copy link

@guidopetri guidopetri commented Oct 14, 2023

Change comparisons to literals from is to ==.

Comparisons to literals with is aren't Pythonic because is uses the underlying object ID to determine whether objects match, whereas == does a value comparison. By switching the comparisons to ==, we have a more consistent set of comparisons, because we don't rely on object IDs but rather the values themselves, which is what we're looking for, anyhow.

This partially fixes #298 , clearing some of the SyntaxWarnings raised.

Change comparisons to literals from `is` to `==`.

Comparisons to literals with `is` aren't Pythonic because `is` uses the underlying object ID to determine whether objects match, whereas `==` does a value comparison. By switching the comparisons to `==`, we have a more consistent set of comparisons, because we don't rely on object IDs but rather the values themselves, which is what we're looking for, anyhow.
@guidopetri
Copy link
Author

The blocking check seems to check the entire commands.py file, I'm not sure what to do about that - I don't really want to make a ton of edits to the 1500 lines in that file :(

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

Successfully merging this pull request may close these issues.

SyntaxWarning and deprecation warning over invalid escape sequences
1 participant