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

2016-01-19 Thread fernando junior
> I have seen at several places "x == None" and "x is None" within > if-statements. > What is the difference? > Which term should I prefer and why? > > > -- > Ullrich Horlacher Server und Virtualisierung > Rechenzentrum IZUS/TIK E-Mail: [email protected] > Uni

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

2016-01-17 Thread Ben Finney
writes: > I prefer (x is None) and (x is not None). There are good reasons to prefer this. But this is not a good reason: > This matches the SQL concept of NULL. That's not really helpful, because it *doesn't* match. > (X = NULL) is not valid since NULL is not a value and cannot be > compare

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

2016-01-17 Thread Chris Angelico
On Mon, Jan 18, 2016 at 8:33 AM, Random832 wrote: > 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

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

2016-01-17 Thread Random832
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

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

2016-01-17 Thread paul.hermeneutic
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. -- https://mail.python.org/mailman/listinfo/python-list

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

2016-01-17 Thread Chris Angelico
On Sun, Jan 17, 2016 at 10:05 PM, Ulli Horlacher wrote: > Chris Angelico wrote: >> On Sun, Jan 17, 2016 at 8:51 PM, Ulli Horlacher >> wrote: >> > I have seen at several places "x == None" and "x is None" within >> > if-statements. >> > What is the difference? >> > Which term should I prefer and

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

2016-01-17 Thread Peter Otten
Ulli Horlacher wrote: > Chris Angelico wrote: >> On Sun, Jan 17, 2016 at 8:51 PM, Ulli Horlacher >> wrote: >> > I have seen at several places "x == None" and "x is None" within >> > if-statements. >> > What is the difference? >> > Which term should I prefer and why? >> >> tl;dr: Prefer "x is No

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

2016-01-17 Thread Ulli Horlacher
Chris Angelico wrote: > On Sun, Jan 17, 2016 at 8:51 PM, Ulli Horlacher > wrote: > > I have seen at several places "x == None" and "x is None" within > > if-statements. > > What is the difference? > > Which term should I prefer and why? > > tl;dr: Prefer "x is None" as a check. And for the nega

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

2016-01-17 Thread Chris Angelico
On Sun, Jan 17, 2016 at 8:51 PM, Ulli Horlacher wrote: > I have seen at several places "x == None" and "x is None" within > if-statements. > What is the difference? > Which term should I prefer and why? tl;dr: Prefer "x is None" as a check. The two checks have slightly different meaning, and alm