How to learn OO of python?

Benji York benji at benjiyork.com
Sat May 21 10:59:47 EDT 2005


 >"Harlin Seritt" <harlinseritt at yahoo.com> wrote:
 >class Animal:
 >   def eats(self):
 >      print 'The animal eats.'
 >   def walks(self):
 >      print 'The animal walks.'

 >   """#the self keyword means that this function will be a class
 >function"""

Mike Meyer wrote:
 > First, the correct terminology is class *method*. Yes, it looks like
 > a function definition, but it's a class method.

Perhaps you meant "instance method" instead of "class method".

 From http://docs.python.org/lib/built-in-funcs.html:

     A class method receives the class as implicit first argument, just
     like an instance method receives the instance.
--
Benji York



More information about the Python-list mailing list