[Tutor] How to Pass lists by value

w chun wescpy at gmail.com
Tue Dec 6 22:24:34 CET 2005

On 12/6/05, Alan Gauld <alan.gauld at freenet.co.uk> wrote:
> Lots of good stuff from Wes snipped...
> >  (a side note here: that only mutable objects have methods.)
> But this is not quite true. Strings are immutable and have lots
> of methods and even tuples and plain integers have methods

oh POO.  i *knew* i shouldn't have been replying in the middle of the
nite.  yes, they all really do.  string methods are even available "to
the public," i.e. by default already defined, unlike those where you
have to override them to "make them work."

what i really wanted to say was that because objects are passed in by
reference, any mutable object's methods that modify it will
(obviously) propagate those changes regardless of where you reference
that object.

i think the main point was altering a mutable object vs. reassigning
the reference to another object.

thanks for keeping me on my toes alan!
-- wesley

ps. i'd like to encourage folks to attend the next PyCon this Feb in
Dallas -- the registration fees have been kept low for one purpose: to
get you to come even if your company is not footing the bill.  it's
great fun, you'll learn a lot, and i hope to meet some of you there! 
more info at http://us.pycon.org ... earlybird reg ends Dec 31!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2006,2001

wesley.j.chun :: wescpy-at-gmail.com
cyberweb.consulting : silicon valley, ca

More information about the Tutor mailing list