Hongyi Zhao <hongyi.z...@gmail.com> 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 <pie...@vanoostrum.org> WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list