why cannot assign to function call
rhodri at wildebst.demon.co.uk
Thu Jan 8 03:46:21 CET 2009
On Thu, 08 Jan 2009 00:45:06 -0000, <rurpy at yahoo.com> wrote:
> When I started using Python I had no problem with Python's
> assignment semantics because I had been using references in
> Perl for years. I did not have a very hard time with Perl's
> references, after I recognized their similarities to C's
> pointers. But as I recall, it took a *long* time to wrap
> my mind around C pointers.
I'd suggest that part of the reason for that is C's blurring
of the line between arrays and pointers. You can treat them
interchangeably enough of the time that when you can't it
catches you by surprise.
My experience of teaching twelve-year olds Python is that
they understand assignment when it's explained in terms of
giving names to these objects (numbers, strings, wombats...)
that we've already shown them. It's a lot harder to get
them to understand the "putting an object into a labelled
box" model when working with other languages. I don't know
why this should be, but it is.
Rhodri James *-* Wildebeeste Herder to the Masses
More information about the Python-list