[Tutor] apply help (newbie)

Sean 'Shaleh' Perry shalehperry@attbi.com
Sat, 15 Dec 2001 08:37:13 -0800 (PST)


> 
> can someone tell me as to what is the difference between these 2 calls:
> 
>               QPushButton.__init__(self,args)         ...1

args is a tuple containing the options passed to Button.__init__ QPushButton
does not take a tuple as its arguments I suspect

>               apply(QPushButton.__init__,(self,)+args)  ...2

passes a tuple (self, args) to QPushButton.__init__ via apply which turns the
arg tuple into the arguments QPushButton is expecting.  In python 2.1 and newer
you can call 

QPushButton.__init__(self, *args) # pass argument tuple through to function.

In 1.x you have only apply() to use.