Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

Marko Rauhamaa marko at pacujo.net
Sun Apr 6 16:23:55 EDT 2014


Chris Angelico <rosuav at gmail.com>:

>>>  * unfaithful husbands on an island ruled by female logicians
>>
>> I don't know that one.
>
> Me neither, although I can see elements of classic logic analysis
> elements. Islands ruled by logicians, people who always tell the truth
> / always tell exact falsehoods, etc, etc. I don't know of any that
> involve unfaithful husbands, but it wouldn't surprise me. Would like
> to hear it though.

Here's how I remember it:

  There was a tiny matriarchal island ruled by a queen. The women were
  capable logicians and that was common knowledge. The idyllic island had
  a problem, though: faithless husbands. The queen decided to solve the
  problem and summoned all women to the market square. She said:

    We need to solve the problem of unfaithful husbands once and for
    all. Now, we all know which men are cheating on their wives except
    our own. I hereby ban you from talking about this matter with each
    other ever again. However, if one day you should come to know your
    husband has been unfaithful, I am ordering you to show no mercy but
    shoot him to death the following night while he is asleep.

  The women left and went back to their business. The night after 40
  days, shots were heard throughout the island.

  How many husbands were unfaithful? How did they find out?

It was a variation of numerous similar puzzles and was the topic of a
dissertation on knowledge logic, IIRC.


Marko



More information about the Python-list mailing list