why cannot assign to function call

Terry Reedy tjreedy at udel.edu
Thu Jan 8 06:22:44 CET 2009


Rhodri James wrote:
> 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.

Kids have little experience with being 'the guest in Room 203' or 'the 
inmate in cell a-23'.




More information about the Python-list mailing list