[Tutor] FW: Can this be done easly
Andre Engels
andreengels at gmail.com
Sun Sep 19 20:54:01 CEST 2010
On Sun, Sep 19, 2010 at 8:33 PM, Roelof Wobben <rwobben at hotmail.com> wrote:
> Hello,
>
> I changed the programm to this :
>
> import unittest
> class Point:
> def __init__(self, x=0, y=0):
> self.x = x
> self.y = y
>
> class Rectangle(object):
> def __init__(self, base_point, width=0, length=0):
> self.base_point = base_point
> self.width = width
> self.length = length
>
> def moverect(roelof, dx, dy):
> roelof.base_point.y += dy
> roelof.base_point.x +=dx
> return roelof
>
> r = Rectangle(Point(3, 4), 20, 30)
> moverect(r, 10, 11)
> assert r.base_point.x == 13, "wrong x position %d" % r.base_point.x
> assert r.base_point.y == 15, "wrong y position %d" % r.base_point.y
>
> But no output at all
Which output had you expected, and why?
--
André Engels, andreengels at gmail.com
More information about the Tutor
mailing list