I'm wrong or Will we fix the ducks limp?
antoon.pardon at rece.vub.ac.be
Wed Jun 8 10:18:22 EDT 2016
Op 08-06-16 om 14:34 schreef BartC:
> So you have partial updates and full updates. A proper reference will
> be able to do both via the reference. Python can only do a partial
> update and the reason is that the reference points to the object, not
> the variable; there is no way to change the variable to link it with
> another, distinct object.
> If the object is a list, then that can be modified to any extent, even
> replacing the contents completely, but it will still be a list. In the
> case of an int or string, then it's impossible to change. So there are
> limitations to what can be done.
> Getting back to Pascal (as I /can/ remember how reference parameters
> work for integers), assigning to a reference integer parameter in a
> function will change the caller's version. Python can only emulate
> that by passing a one-element list or using some such trick. Affecting
> readability and, likely, performance.
I don't see why we should determine what a /proper/ reference
can do, based on what it does in one specific language.
You can do something like that in simula, but only because
simula has two kinds of assignments. One kind that is
simular to python and one that is similar to C.
The one that is similar that python is the reference assignment.
I don't see why the variables in python wouldn't be reference
variables, just because python lacks the "normal" assignment
It is possible to write simula programs that almost exclusively
use reference assignments. Limiting yourself like that, would
also not allow you to do /proper/ referencing.
It seems weird to refuse to call something a /proper/ reference,
while what is missing is not a reference assignment but a
More information about the Python-list