[Python-il] Silly Python riddle

Alon Levy alonlevy1 at gmail.com
Sat Dec 17 16:13:41 IST 2011


ok, it raises RuntimeException so it doesn't count.

On Sat, Dec 17, 2011 at 4:12 PM, Alon Levy <alonlevy1 at gmail.com> wrote:
> );g=f;(
>
> 7
>
> but don't run it :)
>
> On Sat, Dec 17, 2011 at 4:10 PM, cool-RR <cool-rr at cool-rr.com> wrote:
>> So you got it down to 12 characters, nice. But it can be made much shorter.
>>
>>
>> On Sat, Dec 17, 2011 at 2:55 PM, Omer Zak <w1 at zak.co.il> wrote:
>>>
>>> I do not have Python 2.7, so I did the following on Python 2.6.6.
>>> >>> f = lambda: g(); g = lambda:()
>>> >>> f()
>>> ()
>>> >>>
>>>
>>> In other words, '???' is replaced by '); g = lambda:('
>>>
>>> --- Omer
>>>
>>>
>>> On Sat, 2011-12-17 at 14:14 +0200, Ram Rachum wrote:
>>> > Here's a silly Python riddle for you.
>>> >
>>> >
>>> > Today I opened up a Python 2.7 shell, and ran two commands in it.
>>> >
>>> >
>>> >         >>> f = lambda: g(???)
>>> >         >>> f()
>>> >
>>> > (Note that these are the only commands that I ran. You're not allowed
>>> > to run any other commands before them.)
>>> >
>>> >
>>> > The riddle: What's the shortest thing you can put instead of ??? so my
>>> > second command would not raise an exception?
>>>
>>>
>>> --
>>> "Kosher" Cellphones (cellphones with blocked SMS, video and Internet)
>>> are menace to the deaf.  They must be outlawed!
>>> (See also:
>>> http://www.zak.co.il/tddpirate/2006/04/21/the-grave-danger-to-the-deaf-from-kosher-cellphones/
>>> and
>>> http://www.zak.co.il/tddpirate/2007/02/04/rabbi-eliashiv-declared-war-on-the-deaf/)
>>> My own blog is at http://www.zak.co.il/tddpirate/
>>>
>>> My opinions, as expressed in this E-mail message, are mine alone.
>>> They do not represent the official policy of any organization with which
>>> I may be affiliated in any way.
>>> WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html
>>>
>>> _______________________________________________
>>> Python-il mailing list
>>> Python-il at hamakor.org.il
>>> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
>>
>>
>>
>>
>> --
>> Sincerely,
>> Ram Rachum
>>
>> _______________________________________________
>> Python-il mailing list
>> Python-il at hamakor.org.il
>> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
>>
>
>
>
> --
> Alon Levy



-- 
Alon Levy


More information about the Python-il mailing list