> 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
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
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
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
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
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
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
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
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