Coordinate Grid Points

Eric.Gabrielson at gmail.com Eric.Gabrielson at gmail.com
Tue Feb 6 19:11:47 EST 2007


On Feb 6, 4:08 pm, "Gabriel Genellina" <gagsl... at yahoo.com.ar> wrote:
> En Tue, 06 Feb 2007 20:35:43 -0300, <Eric.Gabriel... at gmail.com> escribió:
>
>
>
> > Anyways heres my error:
> > ************************************************************************************************************************
> > ***File "C:/Documents and Settings/Eric/Desktop/Python/2d guessing
> > game.py", line 11, in <module>***
> > ***    randp = Point(random.randint(1, 20), random.randint(1,
> > 20))                                                      ***
> > ***TypeError: default __new__ takes no
> > parameters
> > ***
> > class Point(object):
> >    def _init_(self, x, y):
> >            self.x = x
> >            self.y = y
>
> > #generate random coordinate point
> > randp = Point(random.randint(1, 20), random.randint(1, 20))
>
> _init_ should be __init__ (two leading and trailing underscores)
> That special method is used to initialize your newly constructed Point
> instance.
> See section 9.3.2 on the Python tutorial:http://docs.python.org/tut/node11.html#SECTION0011320000000000000000
>
> --
> Gabriel Genellina

WOW thank you so much I feel like a blind idiot *slaps self on
forehead*




More information about the Python-list mailing list