Loop until condition is true
Scott David Daniels
Scott.Daniels at Acm.Org
Wed Jun 22 13:51:05 EDT 2005
Magnus Lycka wrote:
> In some cases, "==" and "is" happens to give the same result.
> >>> a = 1
> >>> b = 1
> >>> a == b
> 1
> >>> a is b
> 1
>
> But often not.
>
> >>> c = 123456789
> >>> d = 123456789
> >>> c == d
> 1
> >>> c is d
> 0
>
...
> First of all, a lot of Python values except 1 (a.k.a. True)
> are logically true in a Python expression....
Actually, True and 1 are interesting examples.
>>> a, b = 1, True
>>> a == b
True
>>> a is b
False
I suspect you simply forgot this fact.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list