I'm wrong or Will we fix the ducks limp?
paul.nospam at rudin.co.uk
Thu Jun 9 06:00:37 EDT 2016
Marko Rauhamaa <marko at pacujo.net> writes:
> Antoon Pardon <antoon.pardon at rece.vub.ac.be>:
>> 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 see Python as doing the exact same thing with variables as C.
I'm not sure that's a good mental model of what's going on. A variable
declaration in C carries semantics of memory allocation to hold the
value. This isn't so in python
> What is different is that in Python, every expression evaluates to a
> pointer. Thus, you can only assign pointers to variables.
I don't think that's really right - every expression evaluates to an
object. Whether or not that object can be accessed through some variable
or not depends on how the expression is used.
More information about the Python-list