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

AggieDan04 danb_83 at yahoo.com
Mon Apr 20 03:14:44 EDT 2009


On Apr 20, 2:03 am, bdb112 <boyd.blackw... at gmail.com> wrote:
> Is there any obvious reason why
> [False,True] and [True,True]
> gives [True, True]
>
> Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
> (Intel)]

X and Y == (Y if X else X)
X or Y == (X if X else Y)

[False, True] is true, so the and operator returns the second argument.



More information about the Python-list mailing list