[Tutor] __init__ problem

alan.gauld@bt.com alan.gauld@bt.com
Thu, 25 Mar 1999 14:34:56 -0000


Given:

class Transaction:
    def __init__(self):
    	self.total = self.paid = self.change = 0
    	self.GST = 0.07
    	self.items = []

class RentalTransaction(Transaction):
    def __init__(self):
    	Transaction.__init__(self)
    	pass

why do I get:

>>> r = RentalTransaction()
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
  File "C:\Program Files\Python\Projects\transact.py", line 38, in __init__
    Transaction.__init__(self)
TypeError: unbound method must be called with class instance 1st argument
>>> 

Alan G.