On 2006-03-01, John Salerno <[EMAIL PROTECTED]> wrote:

> I do get it. I think I will just have to get used to seeing
> the 'self' argument but understanding that it's not really
> something that is always passed in.

But it _is_ always passed to the function.  You can even pass
it explicity when you call the method if you want:

  #!/usr/bin/python
  
  class MyClass:
      def mymethod(self,p1,p2):
          print self,p1,p2
        
  instance = MyClass()

  MyClass.mymethod(instance,1,2)

  instance.mymethod(1,2)

The two calls are equivalent.  

> I'm trying to train myself to see
>
> def doittoit(self) as def doittoit()

You would be misleading yourself.

> Of course, that might not be a good strategy, because I know
> when it isn't used as an instance method (is that C
> terminology?), then you must explicitly pass the self
> argument.

Exactly.

-- 
Grant Edwards                   grante             Yow!  I guess we can live
                                  at               on his POT FARM in HADES!!
                               visi.com            
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to