On Tue, Sep 28, 2010 at 12:35 PM, Nitin Das <nitin....@gmail.com> wrote: > It seems that ur turtle.position doesn't return a list because of this when > indexing is done on that u get this kind of error. > --nitin
it seemed to me that kind of error but then i found that it was a list, as expected: $ type(turtle.position()) $ <type 'list'> $ abs(turtle.position()[0]) 13.858469413370102 that's why i'm going crazy ... > > On Tue, Sep 28, 2010 at 3:39 PM, Alan Gauld <alan.ga...@btinternet.com> > wrote: >> >> "roberto" <robert...@gmail.com> wrote >> >>> i have the following error when i call this function: >>> 20 def outOfBounds(): >>> ---> 21 if abs(turtle.position()[0]) > >>> turtle.window_height()/2 or abs(turtle.position()[1]) > >>> turtle.window_width()/2: >>> 22 return "true" >>> 23 else: >>> >>> TypeError: 'function' object is unsubscriptable >>> >>> but i can't really figure out where is the problem with this function >>> 'unsubscriptable'; >> >> This means you are trying to use [] on a function. >> eg you might be doing turtle.position[1] instead of turtle.position()[1] >> >> I can't see it in your code sample but I'd check carefully that your >> parens() all balance correctly and are in the right place... >> >> HTH, >> >> >> -- >> Alan Gauld >> Author of the Learn to Program web site >> http://www.alan-g.me.uk/ >> >> >> _______________________________________________ >> Tutor maillist - tu...@python.org >> To unsubscribe or change subscription options: >> http://mail.python.org/mailman/listinfo/tutor > > > _______________________________________________ > Tutor maillist - tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- roberto _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor