On 2006-08-05 09:30:59, Antoon Pardon wrote: >> But this means that C variables are not analog to Python variables, >> [...] > > Yes they are.
Nobody so far has been able to create a simple table with analog operations Python vs C that operates on C /variables/ (not dereferenced pointers) and makes any sense. (Similar to the one Dennis just posted.) Just do it (I mean state a few operations on/with variables in either language, and what the analog operation in the other language is), and I may be a convert :) >> [...] C dereferenced pointers are. > > No they are not. a = b in Python translates to: a = b in C. It doesn't > translate to *a = *b in C. Hold this thought for a little while... > It is true that a = b + c in Python doesn't translate to a = b + c in > C, but since this really is a shortcut of a = b.__add__(c) there > is nothing wrong with tranlating it into something like: > a = IntPlus(b, c) for C, where the IntPlus will provide a new pointer > that points to the sum [...] Did you hold that thought? Now IntPlus() returns a "new pointer", which means that c is a pointer variable, not a value variable. Didn't you write above that it wasn't a pointer? > or we could provide the necessary structures so that we could translate > is as: a = b->__add__(c) Which of course again requires b to be a pointer. You seem not to be clear whether you want to create a C analogy (to Python variables) of C variables (as you stated above) or of C dereferenced pointers (as your code examples show). > [...] then there is something in C deserving the term variable which > behaves like variables do in Python. ?? There /is/ something in C called a variable. And there is something in Python (at least commonly) called variable. But IMO they don't behave in a similar way. (It is obviously possible to create something in C that behaves like a Python variable, but that's then not a C variable. It's a more complex C construct.) Gerhard -- http://mail.python.org/mailman/listinfo/python-list