[False,True] and [True,True] --> [True, True]?????

Andre Engels andreengels at gmail.com
Mon Apr 20 09:10:48 CEST 2009

On Mon, Apr 20, 2009 at 9:03 AM, bdb112 <boyd.blackwell at gmail.com> wrote:
> Is there any obvious reason why
> [False,True] and [True,True]
> gives [True, True]

Well, whether the reason is obvious, I do not know, but the way and
seems to be implemented is:

X and Y =
* X if the boolean value of X is false
* Y if the boolean value of X is true

In this case, bool([False,True]) = true, so the second element is taken.

André Engels, andreengels at gmail.com

More information about the Python-list mailing list