why cannot assign to function call
steve at holdenweb.com
Thu Jan 8 13:18:06 CET 2009
Aaron Brady wrote:
> On Jan 8, 1:45 am, Steven D'Aprano
> <ste... at REMOVE.THIS.cybersource.com.au> wrote:
>> On Wed, 07 Jan 2009 10:17:55 +0000, Mark Wooding wrote:
>>> The `they're just objects' model is very simple, but gets tied up in
>>> knots explaining things. The `it's all references' model is only a
>>> little more complicated, but explains everything.
>> But it *over* explains, because it implies things that "everybody knows"
>> about references in other languages that aren't true for Python.
>> Of course it's not literally true that "everybody knows" that you can use
>> references to implement a swap(x, y) procedure. But people coming from a
>> C or Pascal background tend to assume that everything is like C/Pascal,
>> and there are a lot of them. If C was a rare, unfamiliar language, my
>> opposition to using the term "reference" would be a lot milder. Maybe in
>> another five years?
>>> No, indeed. Python is a language for talking about paperweights. And
>>> it's because of the paperweights that the duck-typing works: all the
>>> paperweights are the same shape and size, so they're physically
>> Okay, the abstraction has leaked again... are the paperweights references
>> to the objects, or the names we've bound objects to? I'm confused...
>> How do we deal with anonymous objects in your model?
> Mark, hi, Steven, pleasure as always.
> Neither side is perfect or wild; (Do admit it); How do we decide what
> is best for newcomers to Python, depending on background?
The crux of this mistake is assuming that all beginners are alike, and
that there is therefore a single "best" way to explain things to them.
Teaching should be a dialog, in which the teacher makes use of knowledge
revealed by the student about their existing knowledge and ways of
thinking to present ideas in an easily assimilable form.
In other words, don't treat all students the same.
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list