Parameter passing in python
Alex Martelli
aleaxit at yahoo.com
Thu May 31 11:23:29 EDT 2001
"Laura Creighton" <lac at cd.chalmers.se> wrote in message
news:mailman.991320527.18316.python-list at python.org...
> (posted by me, but this is from all of us here .... )
>
> ---------------------------------------
> This is what I have to do in my code when inheriting widgets:
>
> import Pmw
>
> class MyButtonBox(Pmw.ButtonBox)
> def __init__(self, parent, **kw):
> ...
> apply(Pmw.ButtonBox.__init__, (self, parent), kw)
>
> Why am I required to do apply to be able to pass the keyword list?
> Some model of Pmw.ButtonBox.__init__(self, args) would be
> more readable.
In Python 2,
Pmw.ButtonBox.__init__(self, parent, **kw)
is equivalent to the apply you have written.
Maybe the docs don't mention it because they go back
to pre-Python-2 times...?
Alex
More information about the Python-list
mailing list