[Tutor] unsubscriptable error
Bob Gailer
bgailer@alum.rpi.edu
Thu Jun 5 10:25:03 2003
At 09:39 AM 6/5/2003 -0400, Vidhya Narayanan wrote:
>Dear python users
>
> I am new to python and am presently in the process of
> learning
>the basics. I wrote a class that calls another class. When I execute my main
>program I get this error message :TypeError: unsubscriptable object
>
>This is how my code goes:
>
>class1: modelmanager
>self.listofmodels.append[RexFunctions1('Model Properties', self.modelActor,
>self.renderer, self.pane)]
>
>Rexfunctions is my second class that needs all the properties within the
>brackets. Not sure where I am making the mistake. Would be great if someone
>could help me out.Thanks in advance.
append is a function. Functions are called by putting () after the function
reference. [] are used for subscripting/slicing, and functions are
not subscriptable objects. Thus you want
self.listofmodels.append(RexFunctions1('Model Properties',
self.modelActor,self.renderer, self.pane))
Bob Gailer
bgailer@alum.rpi.edu
303 442 2625