<var> is None vs. <var> == None
sjmachin at lexicon.net
Fri Jan 23 22:53:25 CET 2009
On Jan 24, 7:48 am, Roger <rdcol... at gmail.com> wrote:
> > And, just for completeness, the "is" test is canonical precisely because
> > the interpreter guarantees there is only ever one object of type None,
> > so an identity test is always appropriate. Even the copy module doesn't
> > create copies ...
> Does the interpreter guarantee the same for False and True bools?
Why do you think it matters? Consider the circumstances under which
you would use each of the following:
if some_name == True:
if some_name is True:
More information about the Python-list