On Jun 4, 2013, at 11:06 AM, Ricardo Aráoz <[email protected]> wrote:
> i) Looking through the mails of this list I've found two uses of super
> a) self.super()
> b) super(MyDateTextBase, self).initProperties()
>
> A couple of questions :
> 1) What is the difference? What's the different use of both?
self.super() was a hack that was designed to make VFP developers a
little more comfortable in Python. The second form is the correct way to call
superclass behavior.
> 2) in b), is it really necessary to use it? I thought
> initProperties() was a user's method.
Generally, this should be strictly user-defined code, so it isn't
necessary. It won't hurt, though.
> ii) And now the original question. I want to send a list to a panel when
> instantiating it so that the panel will create a series of radio buttons one
> for each item of the list. That is :
> mypnl = pnlMyPanel(self, myListOfRadioButtons)
> mySizer.append(mypnl)
>
> So now I have a panel set with the appropriate radio buttons. So how do I
> intercept the parameter (myListOfRadioButtons) and then let the rest of the
> panel's initializing stuff get along? I was thinking of an __init__(self,
> myList, *args, **kw): and then call super(pnlMyPanel, self).__init__(self,
> *args, **kw). Would that be right? Is there a better way?
Assuming that 'pnlMyPanel' is the *class* name, and not the instance
name, yes, that would be correct. FWIW, class names are generally TitleCased in
Python.
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]