On 5/7/14 8:35 PM, Ben Finney wrote:
Marko Rauhamaa <ma...@pacujo.net> writes:
Ben Finney <b...@benfinney.id.au>:
That's why I always try to say “Python doesn't have variables the way
you might know from many other languages”,
Please elaborate. To me, Python variables are like variables in all
programming languages I know.
Many established and still-popular languages have the following
behaviour::
# pseudocode
foo = [1, 2, 3]
bar = foo # bar gets the value [1, 2, 3]
assert foo == bar # succeeds
foo[1] = "spam" # foo is now == [1, "spam", 3]
assert foo == bar # FAILS, ‘bar’ == [1, 2, 3]
Can we make this concrete by speaking about a specific language? I
don't recognize this. I thought we were concerned with beginners
incorrectly thinking Python worked like C, but this is nothing like C.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list