Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101860

Re: "x == None" vs "x is None"

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject Re: "x == None" vs "x is None"
Date Sun, 17 Jan 2016 16:33:13 -0500
Lines 16
Message-ID <mailman.75.1453066407.15297.python-list@python.org> (permalink)
References <n7fo7q$dso$1@news2.informatik.uni-stuttgart.de> <mailman.57.1453025729.15297.python-list@python.org> <n7fshb$f36$1@news2.informatik.uni-stuttgart.de> <CAPTjJmrDZCiDLmRtiukDv2Z1Gz69fz3+_4xYeu-PoXBdC3dtGg@mail.gmail.com> <CAJ4+4aoHHzFJNHvw+LjimO6qHr6dsUskMsQw6y+uiW0jrQzm-w@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain
X-Trace news.uni-berlin.de IgmdZuTgt+7reDYyNlU6TgvBj/KVt4CtaKM0wNZLk0LA==
Cancel-Lock sha1:1HZTw+yuzdTa7LkVuw3xUj0RW70=
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'expressions': 0.07; 'matches': 0.07; 'none)': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:None': 0.09; '"is': 0.16; 'distinct': 0.16; 'none).': 0.16; 'null.': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:166': 0.18; 'not,': 0.22; 'null)': 0.22; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'compare': 0.27; 'operators': 0.29; 'compared': 0.30; 'null': 0.33; 'generic': 0.35; 'but': 0.36; 'subject:" ': 0.36; 'to:addr:python-list': 0.36; 'two': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'some': 0.40; 'from"': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host 166.175.187.150
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:101860

Show key headers only | View raw


<paul.hermeneutic@gmail.com> writes:

> I prefer (x is None) and (x is not None).
>
> This matches the SQL concept of NULL.
>
> (X = NULL) is not valid since NULL is not a value and cannot be compared
> with anything.

The suitably generic SQL operator is "is (not) distinct from", in some
dialects of SQL [certainly if you're using NULL directly you can simply
use is/is not, but the "distinct from" operators can be used to compare
two expressions that may either or both be NULL.

"X is not distinct from Y" == "X = Y or X is NULL and Y is NULL"

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

"x == None" vs "x is None" Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-01-17 09:51 +0000
  Re: "x == None" vs "x is None" Chris Angelico <rosuav@gmail.com> - 2016-01-17 21:15 +1100
    Re: "x == None" vs "x is None" Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-01-17 11:05 +0000
      Re: "x == None" vs "x is None" Peter Otten <__peter__@web.de> - 2016-01-17 12:26 +0100
      Re: "x == None" vs "x is None" Chris Angelico <rosuav@gmail.com> - 2016-01-17 22:29 +1100
      Re: "x == None" vs "x is None" <paul.hermeneutic@gmail.com> - 2016-01-17 11:01 -0700
      Re: "x == None" vs "x is None" Random832 <random832@fastmail.com> - 2016-01-17 16:33 -0500
      Re: "x == None" vs "x is None" Chris Angelico <rosuav@gmail.com> - 2016-01-18 08:38 +1100
      Re: "x == None" vs "x is None" Ben Finney <ben+python@benfinney.id.au> - 2016-01-18 13:46 +1100
  Re: "x == None" vs "x is None" fernando junior <fernandojr.ifcg@live.com> - 2016-01-19 14:20 -0800

csiph-web