osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd truth result with in and ==


On 21/11/2018 20:18, Python wrote:
> $ python3
> Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
> [GCC 5.4.0 20160609] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> 1 in [1,2,3] == True
> False
>>>> 1 in ([1,2,3] == True)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: argument of type 'bool' is not iterable
>>>> (1 in [1,2,3]) == True
> True
> 

See: https://github.com/cosmologicon/pywat ;-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20181121/2bd1b0ea/attachment.sig>