[issue38146] QVariant NULL returns anomalous values in equality statements
John Midgett
report at bugs.python.org
Thu Sep 12 15:25:44 EDT 2019
New submission from John Midgett <jamidgett at gmail.com>:
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 <report at bugs.python.org>
<https://bugs.python.org/issue38146>
_______________________________________
More information about the Python-bugs-list
mailing list