On Nov 10, 2007, at Nov 10:5:46 PM, Jason R Briggs wrote:
Anyway, I'm thinking to keep the original discussion about a
variable being a mailbox, and then talk about the Python
distinction (see updated version below)
You can put things (such as a letter or a package) in a mailbox,
just as you can put things (numbers, text, lists of numbers and
text, etc, etc, etc) in a variable. This mailbox idea is the way
many programming languages work.
In Python, variables are slightly different. Rather than being a
box with things in it, a variable is more like a label which is
stuck on the things. We can pull that label off and stick it on
something else, or even stick the label on more than one thing.
rather than saying "stuck on the things" I'd continue the analogy and
say "stuck on the mailbox", and then pull the label off and stick it
on another mailbox. Mailboxes can have more than one sticker, but
each sticker is unique, so you can ask the question "tell me the
contents of the box labeled Fred" and get only 1 answer. (perhaps
with an illustration). asking the question "tell me the contents of
the box labeled Bob", might give the same contents as Fred (if they
are stuck to the same box), or a different contents if stuck to a
different box.
you can also address undefined variables this way, because asking for
the contents of a box with the label Fred, when Fred hasn't been
stuck on a box, is meaningless.
bb
--
Brian Blais
[EMAIL PROTECTED]
http://web.bryant.edu/~bblais
_______________________________________________
Edu-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/edu-sig