<div dir="ltr">I think the key here is to start with an accurate metaphor, that you can build upon later. Consider this brief introduction to variables:<div><br></div><div>"A variable is like a label on a piece of data. That piece of data can be simple, such as a number or a name, or it can be a more complex data structure. Whenever you want to work with that data, you can just use the name of the variable instead."</div><div><br></div><div>Compare that phrasing to this one:</div><div><br></div><div>"A variable is like a box, which you can put a piece of data in. 

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">That piece of data can be simple, such as a number or a name, or it can be a more complex data structure. Whenever you want to work with that data, you can just use the name of the variable instead."</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div>You can move right from either of these phrases into examples using variables. But when you get to the point where you're focusing on "debugging reference/ value mix ups", one of these introductions serves you much better. The first allows you to jump right into clear explanations of how to consider what's happening in your program. The second requires you to go back on your original explanation, reintroduce the variable concept, and then move forward.</div><div><br></div><div>I started teaching and writing using the "value in a box" model because that's what I was taught. But I have recently switched my teaching and writing over to use the "label on a piece of data" model, because it's more accurate for Python.</div><div><br></div><div>Eric</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 3, 2018 at 9:00 AM, Carl Karsten <span dir="ltr"><<a href="mailto:carl@nextdayvideo.com" target="_blank">carl@nextdayvideo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Not only does that not answer my question, it contradicts previous statements.<br>
<span class=""><br>
>> >> You lost me here. What's wrong with bucket?<br>
<br>
</span><span class="">>> That doesn't tell me how postit notes are different from buckets.<br>
<br>
</span>and, I assure you, even if one (me) understands all that fish in<br>
bucket stuff, I still experience frustration debugging reference/value<br>
mix ups.<br>
<br>
So I totally disagree with "must teach them this" assertion.   Every<br>
minute spent on that displaces time that could be spent on something<br>
else, and I think you will saturate someones attention long before you<br>
run out of better things to teach.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Sun, Jun 3, 2018 at 11:29 AM, David Handy <<a href="mailto:david@handysoftware.com">david@handysoftware.com</a>> wrote:<br>
> If you have two buckets, bucket A and bucket B, and you put a fish into bucket A, a fish does not magically appear in bucket B also.<br>
><br>
>>>> bucket_a = []<br>
>>>> bucket_b = []<br>
>>>> bucket_a.append('fish')<br>
>>>> bucket_b<br>
> []<br>
><br>
> But, if you have only one bucket with two labels on it, bucket A and bucket B, then when you use label A to put a fish into the bucket, and then use label B to look at the bucket, you will see that same fish.<br>
><br>
>>>> bucket_a = []<br>
>>>> bucket_b = bucket_a<br>
>>>> bucket_a.append('fish')<br>
>>>> bucket_b<br>
> ['fish']<br>
><br>
> This is a crucial conceptual understanding our students must gain or they will experience endless frustration trying to debug their programs, not understanding the behavior. Whether they use DreamWeaver or some other editor, this is relevant.<br>
><br>
> David H<br>
><br>
><br>
> On Sunday, June 3, 2018 11:39am, "Carl Karsten" <<a href="mailto:carl@nextdayvideo.com">carl@nextdayvideo.com</a>> said:<br>
><br>
><br>
><br>
>> That doesn't tell me how postit notes are different from buckets.<br>
>><br>
>> I get the python side, I don't get how the analogies are different.<br>
>><br>
>> I am also not sure the target audience comes to the conclusions about<br>
>> implementation you all seem worried about. Hmm, implementation may<br>
>> not be the right word, I think that's not abstract enough.<br>
>><br>
>> If you are talking to a seasoned C programmer that understands what<br>
>> "int a" does, then sure, tell him how Python is different.<br>
>><br>
>> If you are talking to someone who wants to use Dreamweaver to edit<br>
>> code, I am sceptical that spending time on this is a good idea.<br>
>><br>
>> One of the biggest problems I have at Office Hours is spending so much<br>
>> time talking about tangents that we run out of time to finish the<br>
>> original topic. I somewhat expect that the tangents are equally<br>
>> helpful, so I am not too worried about it. But if you are working<br>
>> up a curriculum or lesson plan or whatever, I question what things<br>
>> should be included.<br>
>><br>
>><br>
>><br>
>> On Sun, Jun 3, 2018 at 8:50 AM, Naomi Ceder <<a href="mailto:naomi.ceder@gmail.com">naomi.ceder@gmail.com</a>> wrote:<br>
>> > As Kirby says, of course the data does go somewhere, and that "somewhere"<br>
>> > could be thought of as a container. But "creating" a variable name in Python<br>
>> > doesn't in itself create a container. A lot of beginners will assume that:<br>
>> > a = 1<br>
>> > a = b = c<br>
>> > will actually create three objects, (or containers, or buckets). This leads<br>
>> > to a flawed mental model of what Python actually does, with unexpected<br>
>> > results for mutable types.<br>
>> ><br>
>> > Cheers,<br>
>> > Naomi<br>
>> ><br>
>> > On Sun, 3 Jun 2018 at 13:56, Carl Karsten <<a href="mailto:carl@nextdayvideo.com">carl@nextdayvideo.com</a>><br>
>> wrote:<br>
>> >><br>
>> >> > But you are totally right, Kirby - we've got to get him off of this<br>
>> >> > notion of variables as containers. "Post-its, not buckets" is the<br>
>> way I put<br>
>> >> > it, but I rather like the luggage tag metaphor as well.<br>
>> >><br>
>> >> You lost me here. What's wrong with bucket?<br>
>> >><br>
>> >><br>
>> >> On Sat, Jun 2, 2018 at 3:25 PM, Naomi Ceder <<a href="mailto:naomi.ceder@gmail.com">naomi.ceder@gmail.com</a>><br>
>> wrote:<br>
>> >> > It is a lovely article. Andrew Smith was at PyCon and I had dinner<br>
>> with<br>
>> >> > him<br>
>> >> > and Nicholas one evening and also sat down and chatted with Andrew<br>
>> on a<br>
>> >> > couple of other occasions.<br>
>> >> ><br>
>> >> > He's a smart guy and a likable one, and he is very taken with coding<br>
>> in<br>
>> >> > general, Python in particular, and especially the Python community,<br>
>> and<br>
>> >> > he<br>
>> >> > plans to keep going beyond just that article. I fully expect we'll<br>
>> see<br>
>> >> > and<br>
>> >> > hear more of Andrew Smith's adventures with Python over the coming<br>
>> year<br>
>> >> > or<br>
>> >> > two.<br>
>> >> ><br>
>> >> > But you are totally right, Kirby - we've got to get him off of this<br>
>> >> > notion<br>
>> >> > of variables as containers. "Post-its, not buckets" is the way I put<br>
>> it,<br>
>> >> > but<br>
>> >> > I rather like the luggage tag metaphor as well.<br>
>> >> ><br>
>> >> > And for those of us who are geeks "of a certain age" I can also<br>
>> >> > recommend<br>
>> >> > his book Moondust, which is the story of him tracking down and<br>
>> talking<br>
>> >> > to<br>
>> >> > all of the surviving Apollo astronauts in the early 2000's.<br>
>> >> ><br>
>> >> > Cheers,<br>
>> >> > Naomi<br>
>> >> ><br>
>> >> > On Sat, 2 Jun 2018 at 15:13, kirby urner<br>
>> <<a href="mailto:kirby.urner@gmail.com">kirby.urner@gmail.com</a>> wrote:<br>
>> >> >><br>
>> >> >><br>
>> >> >><br>
>> >> >> One of my screen scraper friends (always reading) just forwarded<br>
>> this<br>
>> >> >> link:<br>
>> >> >><br>
>> >> >> <a href="https://www.1843magazine.com/features/code-to-joy" rel="noreferrer" target="_blank">https://www.1843magazine.com/<wbr>features/code-to-joy</a><br>
>> >> >><br>
>> >> >> A highly literate middle aged writer tackles programming from<br>
>> zero and<br>
>> >> >> winds up in Python after a pilgrimmage through Javascript, and<br>
>> uses the<br>
>> >> >> Twitter API. He meditates on what learning to code might mean<br>
>> to a<br>
>> >> >> fully<br>
>> >> >> developed adult such as himself (connects to Andragogy **).<br>
>> >> >><br>
>> >> >> Nicholas Tollervey, sometime edu-sig poster and Micro:bit<br>
>> avatar, is<br>
>> >> >> very<br>
>> >> >> much a hero in this story, living up to the ideal of a<br>
>> Pythonista as<br>
>> >> >><br>
>> >> >> (A) not religiously dogmatic (re "language wars") yet<br>
>> >> >> (B) having enthusiasm for sharing Python (without too much<br>
>> >> >> proselytizing).<br>
>> >> >><br>
>> >> >> Bravo on a stellar performance!<br>
>> >> >><br>
>> >> >> Quincy Larson of freeCodeCamp fame is another champion of<br>
>> openness and<br>
>> >> >> accessibility (and good advice). I get his emails in my inbox<br>
>> with<br>
>> >> >> gratitude, though I don't follow all the links (helpfully<br>
>> labeled with<br>
>> >> >> estimated reading times, for my internal scheduler -- thanks for<br>
>> the<br>
>> >> >> meta-data!).<br>
>> >> >><br>
>> >> >> In the interests of sparking some edu-sig type discussion (this<br>
>> could<br>
>> >> >> fork<br>
>> >> >> to a new thread), the author Andrew Smith writes:<br>
>> >> >><br>
>> >> >> "Variables are best (if imperfectly) understood as the vessels<br>
>> within<br>
>> >> >> which pieces of data are contained, ready to be worked on. Of<br>
>> many<br>
>> >> >> possible<br>
>> >> >> data types, the most straightforward are numbers and strings,<br>
>> string<br>
>> >> >> being<br>
>> >> >> the name given to text."<br>
>> >> >><br>
>> >> >> In my classes I readily acknowledge the "variable as container"<br>
>> >> >> metaphor<br>
>> >> >> is apt, and agree that Python objects take up memory and so<br>
>> object ==<br>
>> >> >> container (with id) is OK too.<br>
>> >> >><br>
>> >> >> However, the name --> object mapping of a namespace is better<br>
>> imagined<br>
>> >> >> as<br>
>> >> >> "luggage tag -> suitcase" relationship. It's not like the<br>
>> Python name<br>
>> >> >> itself<br>
>> >> >> is the container on the heap.<br>
>> >> >><br>
>> >> >> The object in memory is a possibly fat heavy suitcase, stuffed<br>
>> with<br>
>> >> >> stuff<br>
>> >> >> (e.g. an HttpResponse). However the name is more a label, like<br>
>> a<br>
>> >> >> luggage<br>
>> >> >> tag on a suitcase (and this is the point).<br>
>> >> >><br>
>> >> >> Name : Object :: Luggage Tags :: Suitcase<br>
>> >> >><br>
>> >> >> One suitcase (object) may have many names (connects to garbage<br>
>> >> >> collection<br>
>> >> >> discussion). However at any one moment, a name points to only<br>
>> one<br>
>> >> >> object<br>
>> >> >> (the same name in different modules, both running, still count<br>
>> as<br>
>> >> >> different<br>
>> >> >> names -- scope matters).<br>
>> >> >><br>
>> >> >> So yeah, the object itself is a "container" but what it contains<br>
>> may be<br>
>> >> >> tags to other objects.<br>
>> >> >><br>
>> >> >> Without this separation of "names" from "objects" there's an<br>
>> inevitable<br>
>> >> >> tendency to imagine copies, as how can we have two bowls or<br>
>> boxes with<br>
>> >> >> exactly the same content.<br>
>> >> >><br>
>> >> >> We don't have a visual metaphor for "two suitcases containing<br>
>> exactly<br>
>> >> >> the<br>
>> >> >> same clothes at the same time".<br>
>> >> >><br>
>> >> >> But we do understand "one suitcase having two or more luggage<br>
>> tags."<br>
>> >> >><br>
>> >> >> Surely we have two copies, albeit clones of the same thing. Not<br>
>> so in<br>
>> >> >> Python though. Python is biased against making gratuitous<br>
>> copies of<br>
>> >> >> anything. Keep is spare! (sparse if possible). Don't clutter<br>
>> memory<br>
>> >> >> with<br>
>> >> >> excessive redundancy.<br>
>> >> >><br>
>> >> >><br>
>> >> >> Kirby<br>
>> >> >><br>
>> >> >> **<br>
>> >> >> <a href="http://4dsolutions.net/presentations/pycon2013.pdf" rel="noreferrer" target="_blank">http://4dsolutions.net/<wbr>presentations/pycon2013.pdf</a><br>
>> >> >><br>
>> >> >><br>
>> >> >> ______________________________<wbr>_________________<br>
>> >> >> Edu-sig mailing list<br>
>> >> >> <a href="mailto:Edu-sig@python.org">Edu-sig@python.org</a><br>
>> >> >> <a href="https://mail.python.org/mailman/listinfo/edu-sig" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/edu-sig</a><br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> > --<br>
>> >> > Naomi Ceder<br>
>> >> ><br>
>> >> > @NaomiCeder • <a href="https://www.linkedin.com/in/naomiceder/" rel="noreferrer" target="_blank">https://www.linkedin.com/in/<wbr>naomiceder/</a><br>
>> >> > <a href="https://www.manning.com/books/the-quick-python-book-third-edition" rel="noreferrer" target="_blank">https://www.manning.com/books/<wbr>the-quick-python-book-third-<wbr>edition</a><br>
>> >> ><br>
>> >> > ______________________________<wbr>_________________<br>
>> >> > Edu-sig mailing list<br>
>> >> > <a href="mailto:Edu-sig@python.org">Edu-sig@python.org</a><br>
>> >> > <a href="https://mail.python.org/mailman/listinfo/edu-sig" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/edu-sig</a><br>
>> >> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Naomi Ceder<br>
>> ><br>
>> > @NaomiCeder • <a href="https://www.linkedin.com/in/naomiceder/" rel="noreferrer" target="_blank">https://www.linkedin.com/in/<wbr>naomiceder/</a><br>
>> > <a href="https://www.manning.com/books/the-quick-python-book-third-edition" rel="noreferrer" target="_blank">https://www.manning.com/books/<wbr>the-quick-python-book-third-<wbr>edition</a><br>
>> ______________________________<wbr>_________________<br>
>> Edu-sig mailing list<br>
>> <a href="mailto:Edu-sig@python.org">Edu-sig@python.org</a><br>
>> <a href="https://mail.python.org/mailman/listinfo/edu-sig" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/edu-sig</a><br>
>><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> Edu-sig mailing list<br>
> <a href="mailto:Edu-sig@python.org">Edu-sig@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/edu-sig" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/edu-sig</a><br>
______________________________<wbr>_________________<br>
Edu-sig mailing list<br>
<a href="mailto:Edu-sig@python.org">Edu-sig@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/edu-sig" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/edu-sig</a><br>
</div></div></blockquote></div><br></div></div>