On Sun, Sep 1, 2019, 8:58 AM Terry Reedy wrote:
> On 9/1/2019 2:12 AM, Hongyi Zhao wrote:
>
> > The following two forms are always equivalent:
> > ``if var'' and ``if var is not None''
>
> Aside from the fact that this is false, why would you post suc
On 9/1/2019 2:12 AM, Hongyi Zhao wrote:
The following two forms are always equivalent:
``if var'' and ``if var is not None''
Aside from the fact that this is false, why would you post such a thing?
Trolling? Did you hit [Send] prematurely?
--
Terry Jan Reedy
--
htt
Hongyi Zhao writes:
> Hi,
>
> The following two forms are always equivalent:
>
> ``if var'' and ``if var is not None''
>
> Regards
In [1]: var = 0
In [2]: if var:
...: print('True')
...: else:
...: print('False'
On 2019-09-01 8:12 AM, Hongyi Zhao wrote:
Hi,
The following two forms are always equivalent:
``if var'' and ``if var is not None''
Regards
Not so. Here is an example -
>>> var = []
>>> bool(var)
False
>>> bool(var is not None)
True
>>
On Sun, Sep 1, 2019 at 4:16 PM Hongyi Zhao wrote:
>
> Hi,
>
> The following two forms are always equivalent:
>
> ``if var'' and ``if var is not None''
>
Ahh... False. I'll go False. I'll be honest, I might have heard
that one
Hi,
The following two forms are always equivalent:
``if var'' and ``if var is not None''
Regards
--
https://mail.python.org/mailman/listinfo/python-list