I'm wrong or Will we fix the ducks limp?

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Wed Jun 8 22:49:09 EDT 2016


On Thursday, June 9, 2016 at 4:37:58 AM UTC+12, Marko Rauhamaa wrote:
> I see Python as doing the exact same thing with variables as C.
> 
> What is different is that in Python, every expression evaluates to a
> pointer. Thus, you can only assign pointers to variables.

Yup. I think some people are getting confused over assignment to simple variables as opposed to more complex expressions on the LHS of assignments in Python. For example, given

    a = [1, 2, 3, 4]

compare the different effects of

    b = a
    b = a[:]
    b[:] = a # assuming b already has an appropriate initial value

not to mention other possibilities...



More information about the Python-list mailing list