[Python-il] Silly Python riddle

Ram Rachum ram at rachum.com
Sat Dec 17 15:13:12 IST 2011


Haha, I didn't consider that solution. And yes, it can be done with less
characters than 13.

On Sat, Dec 17, 2011 at 3:04 PM, ofri raviv <ofri.raviv at gmail.com> wrote:

> my trivial 13 char solution is
> );g=lambda:(0
> which gives
> f = lambda: g(*);g=lambda:(0*)
> but i'm sure this can be done with less...
>
>
> On Sat, Dec 17, 2011 at 2:56 PM, Ram Rachum <ram at rachum.com> wrote:
>
>> Of course you can put a function call inside a lambda:
>>
>> >>> f = lambda: sum((1, 2, 3))
>>> >>> f()
>>> 6
>>
>>
>> No easter eggs or JIT magic are involved in this riddle.
>>
>> On Sat, Dec 17, 2011 at 2:55 PM, asaf greenberg <asafgreenberg at gmail.com>wrote:
>>
>>>  On 17/12/2011 14:14, Ram Rachum wrote:
>>>
>>> f = lambda: g(*???*)
>>>
>>> i didn't know lambdas can be used with a function call.
>>>
>>> actaully - i can't even use lambda: f() at all, even without your
>>> restrictions.
>>>
>>> unless there's a jit compiler easter egg built in, like lambda g('if
>>> this string then return a 3d-maze with pictures of the developers')...
>>>
>>> _______________________________________________
>>> Python-il mailing list
>>> Python-il at hamakor.org.il
>>> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
>>>
>>>
>>
>> _______________________________________________
>> Python-il mailing list
>> Python-il at hamakor.org.il
>> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://hamakor.org.il/pipermail/python-il/attachments/20111217/29734ef1/attachment-0001.htm>


More information about the Python-il mailing list