Message386584
Gary, I cannot replicate that inconsistency in 3.9.0.
>>> x = "abc"
>>> x is "abc"
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
True
>>> if x is "abc": pass
...
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
I don't believe that you should be getting a SyntaxError at all, and both cases should give the same warning. Can you double-check your code, and if you confirm that they give a different result or a SyntaxError, let us know here. Otherwise Raymond and Dennis are correct: this is working correctly. |
|
Date |
User |
Action |
Args |
2021-02-07 07:39:36 | steven.daprano | set | recipients:
+ steven.daprano, rhettinger, Dennis Sweeney, garylitvin |
2021-02-07 07:39:36 | steven.daprano | set | messageid: <1612683576.68.0.478005888258.issue43151@roundup.psfhosted.org> |
2021-02-07 07:39:36 | steven.daprano | link | issue43151 messages |
2021-02-07 07:39:36 | steven.daprano | create | |
|