Antoon Pardon <antoon.par...@rece.vub.ac.be>: > Your challenge, shows that you don't fully understand what reference > variables are. The behaviour you see in Pascal, doesn't depend (alone) > on the parameter being a reference parameter. It also depends on the > fact that the assignment in pascal mutates the variable that is > assigned to. Variables are references if they are aliases, so that if > you mutate through one alias, the mutation is visible through other > aliases. So your challenge comes down to expecting me to mutate > something by means that in python don't allow mutation.
I think bringing Pascal in this discussion is only confusing matters. Let me repeat the abstract Python data model I gave a couple of days back: - there are labeled *pegs* ("variables") - there are *puppies* ("objects") - each peg has one *leash* hanging from it - each leash is tied to a puppy - each puppy can have zero one or more leashes tied to it - some puppies can hold leashes in their *mouths* - some puppies can take hold of new leashes and let go of leashes I'm not joking. Everybody is arguing about preconceived notions tied to terminology. The peg-leash-puppy model is accurate and extensive. We can now give semantics to Python's execution model. For example, - every rvalue expression evaluates to a leash - the lvalue expression identifies a peg or a mouth - the assignment statement hangs a leash on a peg or in a mouth Marko -- https://mail.python.org/mailman/listinfo/python-list