[EMAIL PROTECTED] a écrit : > Sorry for the vague subject. Not sure what the right terminology is. > > How can I use an instance's data by reference to the instance name, > not the instance attribute? OK the question is probably really poor > but hopefully an example will make it clear. > > >>x=1 >>type(x) > > <type 'int'> > >>x.__add__(1) > > 2 > >>print x > > 1 > >>3*x > > 3 > > In this case x is an integer. My understanding is that x in an > instance of an integer class. Since it refers to only a single value > things like print x, 3*x etc operate on the instance name which seems > to refer to the instance data, not the instance itself. I want to do > the same for my own classes.
http://docs.python.org/ref/specialnames.html -- http://mail.python.org/mailman/listinfo/python-list