[Tutor] sending data

Sheila King sheila@thinkspot.net
Tue, 15 May 2001 21:36:23 -0700


On Wed, 16 May 2001 14:16:07 +1000, "wheelege" <wheelege@tsn.cc>  wrote about
Re: [Tutor] sending data:

:
:A = '1' # or
:A = "1" # or
:A = 1
:
:  Are all fine.  This stores the string '1' (and in the last case, the integer 1) into the variable A.  Now, to pass this onto a class method, just include it in the argument list.

I think it is very dangerous, in Python, to think that the data is being "stored
in a variable name", and can lead to future difficulties. While this is what
happens in other programming languages (such as Pascal, and C) this is not what
happens in Python.

In Python the variable is set to point to the object.

At least, that is how I have come to understand it. This was a very difficult
thing for me to finally get through my head (since I come from a
Pascal/C++/Basic/Fortran background, where it is as described in the quote
above). Anyhow, until I got this straight, I was very confused about how some
things work in Python.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/