[Tutor] inheritance and super() function in python

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Apr 23 17:28:52 CEST 2014


On 23/04/2014 14:56, Jorge Leon wrote:
>>   class Cylinder(Obstacle):
>>     def __init__(self,position, height, radius):
>>         super(Obstacle,self).__init__(position)
>>
>> But it looks to me like the last line should be
>>          super(Cylinder, self).__init__(position)
>>
>
> Hey, thanks again for the help and sorry about all the format errors I
> was able to successfully use super(). The classes were made with the
> old style (thanks Steve for the blog post). Using the last bit of
> corrections the program successfully sourced the constructor from the
> parent class.
>
> Again, thank you for the prompt and professional response.
>
> Jorge

Excellent article here on super for anybody who's interested 
http://rhettinger.wordpress.com/2011/05/26/super-considered-super/

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com




More information about the Tutor mailing list