Defining class attributes + inheritance

Rhodri James rhodri at wildebst.demon.co.uk
Tue Mar 8 19:50:11 EST 2011


On Wed, 09 Mar 2011 00:29:18 -0000, Martin De Kauwe <mdekauwe at gmail.com>  
wrote:

> On Mar 9, 10:20 am, Ethan Furman <et... at stoneleaf.us> wrote:
[snip]
>> Just make sure and call the parent's constructor, either with
>>
>> class NewClass(BaseClass):
>>      def __init__(self, ....):
>>          BaseClass.__init__(self, other_params)
>>
>> or
>>
>> class NewClass(BaseClass):
>>      def __init__(self, ....):
>>          super(NewClass, self).__init__(....)
>>
>> ~Ethan~
>
> Hi thanks, but I think I am implementing it wrong then?
>
> BaseClass has 4 attributes and when I tried what you said
>
> class NewClass(BaseClass):
>     def __init__(self):
>         super(NewClass, self).__init__(new_thing)
>
> I get the error
>
> TypeError: __init__() takes exactly 1 argument (6 given)

Please give us either the rest of the code or the rest of the
traceback, or preferably both.  Without one or the other we have
little hope of guessing what you've typed.

-- 
Rhodri James *-* Wildebeest Herder to the Masses



More information about the Python-list mailing list