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

Use ==/!= to compare str, bytes, and int literals #13

Merged
merged 1 commit into from Apr 13, 2020

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Apr 13, 2020

Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise SyntaxWarnings so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

% python3.8

>>> '*' is '*'
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
True

Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise SyntaxWarnings so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

% python3.8
```
>>> '*' is '*'
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
True
```
@ifzhang ifzhang merged commit b5bc54a into ifzhang:master Apr 13, 2020
@cclauss cclauss deleted the patch-1 branch April 13, 2020 07:42
qanelph pushed a commit to supervisely-ecosystem/FairMOT that referenced this pull request Aug 5, 2021
Use ==/!= to compare str, bytes, and int literals
qanelph pushed a commit to supervisely-ecosystem/FairMOT that referenced this pull request Aug 11, 2021
Use ==/!= to compare str, bytes, and int literals
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.

None yet

2 participants