D
Dennis Lee Bieber
PythonThere's maybe a point in comparing Python variables to C pointers. But it
lacks in the respect that a C programmer is used to modify memory locations
through pointers. A Python programmer isn't used to modify memory locations
in the first place, and simple objects don't get modified at all. There's
no Python equivalent to "int*p=345; *p++;". (There's no need for that in
Python; I'm not saying this shows a superiority of C. It just shows a
different concept of what "variable" means.)
c = c + 100
pseudo-C (where I use _p to indicate explicit pointer; and all data
objects are a structure of the form: int ref_count; <object type> data)
scratch_p = malloc()
scratch_p->data = c_p->data + 100
scratch_p->ref_count = 1
c_p->ref_count--
if !c_p->ref_count
free(c_p)
c_p = scratch_p
-------
b = a
is
b = a
b->ref_count++
For me, the point of this discussion was that it makes sense to look at it
/differently/. Once you've done that, there's no problem in continuing to
use the (vaguely defined) term "variable".
Think the above is "different" enough <G>
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/