[Edu-sig] python for kids...

Brian Blais bblais at bryant.edu
Sun Nov 11 01:08:13 CET 2007


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
bblais at bryant.edu
http://web.bryant.edu/~bblais



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/edu-sig/attachments/20071110/86b58874/attachment-0001.htm 


More information about the Edu-sig mailing list