calling superclass' method with list positional arg
Steve Purcell
stephen_purcell at yahoo.com
Fri Apr 13 05:44:02 EDT 2001
Steven Haryanto wrote:
> # then pass the items to superclass' constructor
> apply(Bag.__init__, args_)
>
> Is there an elegant way to do this so I can still declare
> Bag's __init__ as 'def __init__(self, *items)', but I don't
> need to create a temporary list like below?
I think you want
apply(Bag.__init__, (self,) + args_)
-Steve
--
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Any opinions expressed herein are my own and not necessarily those of Yahoo
More information about the Python-list
mailing list