<var> is None vs. <var> == None
John Machin
sjmachin at lexicon.net
Fri Jan 23 16:53:25 EST 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:
if some_name:
More information about the Python-list
mailing list