Please help me to understand classes

Johann Spies Johann.Spies at p98.f112.n480.z2.fidonet.org
Tue Jun 29 15:03:55 EDT 1999


From: Johann Spies <jhspies at futurenet.co.za>

I have been playing around with python for some time now, but I am a
relative newbie as it is my hobby and normally I have very little time for
programming.  I am on leave now and want to write a program but I find
python a very difficult language to comprehend despite the fact that I
have a few years of experience in programming a language like Pascal.
Maybe it is because I have little experience in OOP.

Can somebody explain to me why the following program produces no output:
---------------------------------------------
class A:

    def druk():
        print 'Jy is in Class A'

class B:

    def druk():
        print 'Jy is in Class B'
        
a = A()
c = B()
c.druk
a.druk
---------------------------------------------


 --------------------------------------------------------------------------
| Johann Spies                                 Windsorlaan 19              |
| jhspies at futurenet.co.za                3201 Pietermaritzburg             |
| Tel/Faks Nr. +27 331-46-1310		       Suid-Afrika (South Africa)  |
 --------------------------------------------------------------------------

     "One thing have I desired of the LORD, that will I seek
      after; that I may dwell in the house of the LORD all
      the days of my life, to behold the beauty of the LORD,
      and to inquire in his temple."            
                               Psalms 27:4       




More information about the Python-list mailing list