今天看 Python 参数那一章,看到除了顺序参数、关键字参数之外还有 *para **para 的参数调用方式,类似于C里面的指针和指向指针的指针(好怀念),*para是指没有明确数量的参数元组 **是指没有明确数量的关键字参数字典,练习题如下:
def story(**kwds):
return 'Once upon a time, there was a '\
'%(job)s called %(name)s.' % kwds
def power(x, y, *others):
if others:
print 'Received redundant parameters:', others
return pow(x, y)
def interval(start, stop=None, step=1):
'Imitates range() for step > 0'
if stop is None:
start, stop = 0, start
result = []
i = start
while i < stop:
result.append(i)
i += step
return result
信息化的道路上一直看到听到大家撕逼,业务部门的、省里用户的、IBM的 顶上还有领导的欲求不满... 不开心  ̄へ ̄