Aurélien Campéas schrieb: > none a écrit : >> Hello, >> >> IIRC, I once saw an explanation how Python doesn't have >> "variables" in the sense that, say, C does, and instead has bindings >> from names to objects. Does anyone have a link? >> >> Thanks, >> >> Ami > > That's something I've often heard and I don't get it. Somehow I don't > understand how C variables are not like python bindings (the differences > being that C variables are statically typed and completely disappear at > run-time; are these differences important enough to warrant such a shift > in terminology ? (yes there are some other differences, but then the > question is asked in a context of pedagogy, where the audience is > introduced to the basics)) > > I mean : aren't C variables also bindings from names to objects ? Or what ?
There are cruicial differences. In C, you have names pointing to physical memory locations - fixed locations, that is. Thus you can do e.g. some_struct a, b; a = b = some_struct_value; a.bar = 10; b.bar = 20; Now a.bar will be different from b.bar This is totally different from python semantics, where a = b = some_object a.bar = 10 b.bar = 20 will result in both times the same object being manipulated. So python variables are more equivalent to pointers in C. Diez -- http://mail.python.org/mailman/listinfo/python-list