#!/usr/bin/python
# -*- coding: UTF-8 -*-
# #eg.1
# #使用元组或字典的参数调用函数
# def fun(a,b):
# print a,b
#
# apply(fun,("one","two"))
# apply(fun,(1,2+3))
#
#
#
# #eg.2
# #使用apply函数传递关键字参数
# apply(fun,("one","two"))
# apply(fun,("one",),{"b":"two"})
# apply(fun,(),{'a':'one','b':'two'}
#eg.3
#使用函数调用基类的构造函数
class Rectangle():
def __init__(self,color="white",width=10,height=10):
print "create a ",color,self,"sized",width,"x",height
class RoundedRectangle(Rectangle):
def __init__(self,**kw):
apply(Rectangle.__init__,(self,),kw)
rect=Rectangle(color="green",height=100,width=100)
rect=RoundedRectangle(color="blue",height=20)