[Tutor] Can this be done easly

Roelof Wobben rwobben at hotmail.com
Sun Sep 19 10:49:12 CEST 2010



Hello, 
 
I have this programm :
 
class Point:
     def __init__(self, x=0, y=0): 
         self.x = x
         self.y = y
     
class Rectangle(Point):
    def _init_(self, width=0, length=0):
        self.width = width
        self.length = length
        
punt = Point(3,4)
rechthoek = Rectangle (punt,20,30)
 
Now I wonder how I can change this to rechthoek = rectangle (punt,20,20)
This one gives as error message  : 
 
Traceback (most recent call last):
  File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 12, in <module>
    rechthoek = Rectangle (punt,20,30)
TypeError: __init__() takes at most 3 arguments (4 given)
 
Roelof
  		 	   		  


More information about the Tutor mailing list