Do I always have to write "self." ?
mwh21 at cam.ac.uk
Fri Apr 28 15:05:57 CEST 2000
"Louis M. Pecora" <pecora at anvil.nrl.navy.mil> writes:
> In the above I would describe things as follows (am I right or wrong?):
> (1) data and self.data point to the same object, a list, so when a
> method is called it is the method that works on that instance of a list
> and either data or self.data will append 'foo' to the same list object.
> (2) when you do more=more+1 an new object (the more+1 value) is created
> and more then points to it and no longer to the old value of self.more.
> The latter still exists and points to the original 10 object.
> (3) Similar story here for interesting where a new object
> interesting[10:] is created and interesting is "switched" to point to
> it. self.interesting still points tohe "foo" object.
> I hope I got that right, because they have tripped me up a few times.
Yes! That's right. Simple isn't it (once you understand, anyway)?
If i don't understand lisp, it would be wise to not bray about
how lisp is stupid or otherwise criticize, because my stupidity
would be archived and open for all in the know to see.
-- Xah, comp.lang.lisp
More information about the Python-list