New submission from John Midgett <[email protected]>:
Per PEP 8, equality comparisons to None should use the "is" or "is not"
keywords. However, if x is a {QVariant}NULL, the equality statement with the
"is" keyword returns FALSE whereas the "==" comparison returns TRUE.
Hence where cond = {QVariant}NULL:
if cond is None # Returns False
if cond == None # Returns True
This can cause some unexpected code anomalies (as it did for me) when adjusting
code for PEP 8 compliance.
----------
components: Interpreter Core
messages: 352227
nosy: John Midgett
priority: normal
severity: normal
status: open
title: QVariant NULL returns anomalous values in equality statements
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38146>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com