Calling member functions?
david_j_dawkins at spamless.hotmail.com
Thu Dec 13 19:39:15 CET 2001
"Oleg Broytmann" <phd at phd.pp.ru> wrote in message
news:mailman.1008247097.13811.python-list at python.org...
> On Thu, Dec 13, 2001 at 12:22:17PM -0000, David Dawkins wrote:
> > > > self.m_method(self.m_object) ## naive attempt
> > >
> > > ^^^^^^^^ You call a method with one argument, but the
> > > Callback method does not accept any arguments.
> > but then how does Handler.Callback receive its own "self" value? In this
> m_method is not a method - it is *bound* method! It is h.Callback - an
> object, that stores both h and Callback! So when you call it, Python gets
> the self for Callback from the bound method; the self will by just h!
> vvvvvvvvvv - you initialized m_method with the
> > > > n = Notifier( h, h.Callback )
Yes, I understand now! Thanks for your help.
More information about the Python-list