http://dis.4chan.org/read/prog/1180084983/ 哈哈,有点意思,再加一个: Python 2.5 programmer:
def fact(x): return x * fact(x - 1) if x > 1 else 1 print fact(6)
http://dis.4chan.org/read/prog/1180084983/ 哈哈,有点意思,再加一个: Python 2.5 programmer:
def fact(x): return x * fact(x - 1) if x > 1 else 1 print fact(6)
1 评论:
这个最经典,如果你见过win api中createWindow()之类的函数的话:
#Windows programmer
NULL = None
def CalculateAndPrintFactorialEx(dwNumber,
hOutputDevice,
lpLparam,
lpWparam,
lpsscSecurity,
*dwReserved):
if lpsscSecurity != NULL:
return NULL #Not implemented
dwResult = dwCounter = 1
while dwCounter <= dwNumber:
dwResult *= dwCounter
dwCounter += 1
hOutputDevice.write(str(dwResult))
hOutputDevice.write('\n')
return 1
import sys
CalculateAndPrintFactorialEx(6, sys.stdout, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
下面那个照抄Java,更经典~~
发表评论