Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Ram Rachum <ram <at> rachum.com>
Subject: Re: Silly Python riddle
Newsgroups: gmane.comp.python.israel
Date: Saturday 17th December 2011 14:41:14 UTC (over 6 years ago)
Haha, I didn't think of all those creative answers when I asked this
riddle! I'm sure happy that none of them (so far!) have reached 7
characters, which is the length of my solution.

On Sat, Dec 17, 2011 at 4:38 PM, Omer Zak  wrote:

> Another attempt at golfing down the solution:
> >>> f=lambda:g(0);g=(id)
> >>> f()
> 10482512
>
> The solution is '0);g=(id', 8 characters long.
> If there is a built-in function whose name is 1-character long, then the
> solution can be made to be 7 characters long.
>
>
> On Sat, 2011-12-17 at 14:55 +0200, Omer Zak 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?
> >
> >
>
> --
> $ python
> >>> type(type(type))
>           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
> [email protected]
> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
>
 
CD: 3ms