[Tutor] Unbound methods

am@fx.ro am@fx.ro
Wed Nov 20 16:25:03 2002


Hello all!

I am new to both python and this list.

I am trying to write my first silly script containing a class 
with a few methods (this script might become someday a part
of a WAV player):

class WavSet:
    def __init__(self):
        print 'Init'
    def open(self):
        print 'Open'
    def close(self):
        print 'Close'
    def play(self,wav_id):
        print 'Play %d'%(wav_id,)

w=WavSet
print w.open()
print w.close()

I got an error that i don't understand: 
TypeError: unbound method must be called with class instance 1st argument

I have found a paragraph in the Reference (types.html) about unbound
methods, but i still have no clue about what am i doing wrong.
Please help.


Best regards,
Adrian Maier
(am@fx.ro)