Odd truth result with in and ==
Thomas Jollans
tjol at tjol.eu
Thu Nov 22 04:13:15 EST 2018
On 2018-11-22 09:58, Chris Angelico wrote:
> On Thu, Nov 22, 2018 at 7:51 PM Thomas Jollans <tjol at tjol.eu> wrote:
>>
>> 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 ;-)
>>
>
> I find it fascinating that quite a few of the Wats given on the
> landing page are specifically poking fun at IEEE floating point
> (completely documented and intended behaviour that exists across many
> languages), yet the "Wat Quiz", also in that repository, specifically
> excludes floats. TRWTF is inconsistently poking fun at a language's
> consistencies.
Clearly the author was struggling to find "wat"s of the sort you get in
Ruby or JavaScript.
More information about the Python-list
mailing list