why 'lambda' and 'reduce'?
news at manuelmgarcia.com
Thu Jun 12 19:36:14 CEST 2003
On Thu, 12 Jun 2003 02:21:57 GMT, Manuel Garcia
<news at manuelmgarcia.com> wrote:
>If anyone ever asks for what good are 'lambda' and 'reduce', show them
Last night I was thinking about this silly code, and figured out a way
1) add just one more character to the progam, so the expression goes
from 298 characters to 299 characters.
2) double the speed
3) most importantly, add another lambda!
print (lambda p:p+'.'+p[1:])(
(lambda F:(lambda S:reduce(
lambda n:reduce(lambda x,_:(
the output is still perfectly accurate, of course. (Runs pretty fast
in Python 2.3b1, actually)
(btw I don't see why it only 'almost' qualifies for an "obfuscated"
code contest. I wrote it, and I forgot how it worked around the time
I added the third 'lambda' ;-)
More information about the Python-list