Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PHP is awesome

Name: Anonymous 2007-08-28 17:56 ID:xY3vpdBA

This is how you create a anonymous function in PHP:

$newfunc = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);');


Name: Anonymous 2007-08-28 18:38 ID:SysrucEy

Equivalent code in Python:
newfunc = lambda a,b: "ln(%g) + ln(%g) = %g" % (a, b, math.log(a*b))

15 characters shorter, and will automatically format the result to use exponential format. Clearly, Python is superior to PHP

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List