[Edu-sig] Python sequences by reference - how to make clear?
Guido van Rossum
guido@python.org
Thu, 19 Sep 2002 10:03:53 -0400
> So what is the point? I wrote this message in hope that there are
> more people with similar experience. My question is - how to explain
> to novice non-programmer users (maybe mathematically "infected") the
> quirks of Python sequence objects? Which methodology to use in
> programs so we can clearly see we work with "pointers"? Or maybe
> someone can propose the changes to the Language to overcome this
> (psychological) barrier? I feel this as a serious obstacle in using
> Python (my students experienced it too).
I usually draw a picture containing a few objects as boxes and a
container as a separate box with arrows representing references to
those boxes. I do this as early on in the tutorial as possible --
basically as soon as lists are covered.
See e.g. page 16 of
http://www.python.org/doc/essays/ppt/lwnyc2002/intro22.pdf
(this discusses a slightly different guise of the same problem -- but
it's really the same problem).
--Guido van Rossum (home page: http://www.python.org/~guido/)