Skip to content

Use != instead of is not for values. #395

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

Merged
merged 1 commit into from
Oct 18, 2021
Merged

Conversation

dlech
Copy link
Contributor

@dlech dlech commented Oct 16, 2021

This uses the ==/!= operators instead of is/is not when checking the return value of RPC calls. In Python, is not tests if the two operands are the same object whereas != test that they have the same value. is not just happens to work for small integers due to an implementation detail in CPython (e.g. see StackOverflow).

This uses the `==`/`!=` operators instead of `is`/`is not` when checking
the return value of RPC calls. In Python, `is not` tests if the two
operands are the same object whereas `!=` test that they have the same
value. `is not` just happens to work for small integers due to an
implementation detail in CPython (e.g. see [StackOverflow][1]).

[1]: https://stackoverflow.com/a/133024/1976323
Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha!

@julianoes
Copy link
Collaborator

Thanks!

@julianoes julianoes merged commit 5e9d69c into mavlink:main Oct 18, 2021
@dlech dlech deleted the equals-not-is branch October 18, 2021 14:20
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.

2 participants