Hongyi Zhao <[email protected]> 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')
False
In [3]: if var is not None:
...: print('True')
...: else:
...: print('False')
True
--
Piet van Oostrum <[email protected]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
