Python4Kids New Tutorial: Weird Binding Stuff
May 23, 2012, 08:00 (0 Talkback[s])
(Other stories by Brendan Scott)
How to Help Your Business Become an AI Early Adopter
A short tutorial this week on some oddities with the way Python stores and references ("binds to") data. You might remember, a long time ago, we talked about how, when we store data in a variable, it’s like putting your stuff in a bucket so that you can access it later. Variables in Python actually turn out to be references to objects. A side effect of this is that, in some cases, Python doesn’t work out how you think it will – typically this is where your object is a list or dictionary (actually any object, but you only notice this effect with compound objects) that you think you have copied, but you actually haven't.