On 2006-08-05, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > 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.)
Do you have a table between analog operations on mathematical variables and C variables of Python variables? > 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 :) There is only one operation on variables in general and that is assignment. >>> [...] 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? Read again. What is written is that I deny it is a *dereferenced* 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. Yes but just a pointer, not a dereferenced pointer. >From the way you seem to view dereferenced pointers as something different as variables, the only thing that makes sense IMO is that you mean the piece of memory the pointer points to, when you use "dereferenced pointer" the alternative is that you don't want to recognize pointer variables as variables in C. > 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). What exactly do you mean with dereferenced pointers. I don't talk about *dereferenced* pointers. That is your addition. >> [...] 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.) You are special pleading here. The variables don't behave differently, all C variables use the same rules, a C variable doesn't behave differently depending it's type. An identifier is not any less a variable because it is a pointer to a structure instead of just an int. Your statement that it is not a variable but a more complex construct is again showing your confusing between the variable and what it is attached to. The variable is the name/identifier/symbol, it is not the (memory) location/value/object that is somehow attached to that this name/identifier/symbol. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list