[Tutor] __init__ problem

Joseph J. Strout joe@strout.net
Thu, 25 Mar 1999 08:12:32 -0800


At 6:34 AM -0800 03/25/99, alan.gauld@bt.com wrote:

>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
>>>>

Beats me.  I copied and pasted your code, and it works just fine for me.
The code is correct (though the "pass" on the second line of
RentalTransaction.
__init__ is superfluous).  Looks like a bug in your Python, perhaps?

Cheers,
-- Joe
,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'