You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/03/26 14:37:24 UTC

[GitHub] [cassandra] cclauss opened a new pull request #492: Use ==/!= to compare str, bytes, and int literals

cclauss opened a new pull request #492: Use ==/!= to compare str, bytes, and int literals
URL: https://github.com/apache/cassandra/pull/492
 
 
   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
   ```
   >>> 'nt' is 'nt'
   <stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
   True
   >>> nt = 'n'
   >>> nt += 't'
   >>> nt == 'nt'
   True
   >>> nt is 'nt'
   <stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
   False
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org