Re: why cannot assign to function call



On Jan 8, 1:45 am, Steven D'Aprano
<ste...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
On Wed, 07 Jan 2009 10:17:55 +0000, Mark Wooding wrote:
snip
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
interchangeable.

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?

--
Steven

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?
.



Relevant Pages

  • Re: why cannot assign to function call
    ... Python objects can be in two places at once, ... explaining the full details in advance, but the time comes to put away ... The `it's all references' model is only a ... it's because of the paperweights that the duck-typing works: ...
    (comp.lang.python)
  • Re: why cannot assign to function call
    ... about references in other languages that aren't true for Python. ... C or Pascal background tend to assume that everything is like C/Pascal, ... it's because of the paperweights that the duck-typing works: ... revealed by the student about their existing knowledge and ways of ...
    (comp.lang.python)
  • Re: why cannot assign to function call
    ... The Python program deals solely with references; ... commonly understood in the field of programming language design. ... The argument passing model `pass-by-value' has a number of distinctive ...
    (comp.lang.python)
  • Re: Writing huge Sets() to disk
    ... that this code takes a lot of extra memory. ... > I believe it's the references problem, ... It's a bit unfortunate that all those instance variables are global to ... it merely aggregates it for use in storing new Python objects. ...
    (comp.lang.python)
  • Re: why cannot assign to function call
    ... The Python program deals solely with references; ... when you say "the Python program", ... The value of an array is the ...
    (comp.lang.python)