12/18: Inheritance Syntax


#1

So I have no idea why this isn't working..

class Shape(object):
"""Makes shapes!"""
def init(self, number_of_sides):
self.number_of_sides = number_of_sides

class Triangle(Shape):
def init(self, side1, side2, side3):
self.side1 = side1
self.side1 = side2
self.side3 = side3

What is this topic looking for? I'm getting the error "Oops, try again. Did you define Triangle's init() method to take the four arguments listed?"


#2

@kylecbarnes,
Python init is the __init__ method
Have a read in a discussion/opinion
http://stackoverflow.com/questions/625083/python-init-and-self-what-do-they-do


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.