anything like C++ references?

Bryan belred1 at yahoo.com
Mon Jul 14 02:28:09 EDT 2003


"Stephen Horne" <intentionally at blank.co.uk> wrote in message
news:rp94hvc8fg6h91oe7ctqq9jn9ku3nlud1k at 4ax.com...
> On Sun, 13 Jul 2003 22:42:21 GMT, "Bryan" <belred1 at yahoo.com> wrote:
>
> >
> >> 3.  Why is there no way to reference an immutable object via a
> >> pointer, other than stuffing it into a mutable object designed for
> >> some purpose other than simple pointer behaviour?
> >>
> >
> >>>> a = (1, 2, 3)
> >>>> b = a
> >>>> id(a)
> >15471760
> >>>> id(b)
> >15471760
> >>>> print b[1]
> >2
> >>>>
> >
> >
> >i just referenced an immutable object via a "pointer" and i __did_not__
> >stuff it into a mutable object as you say.
> >a and b "point" to the same object.
>
> Technically, but what is the point? You can't do pointer-style things
> with it. You can't change the object in any way without changing the
> id, and you can't use the mechanism to, for instance, allow 'var'
> parameters.
>

can you show what functionality is missing by not being able to do
"pointer-style things"?  here are two variables:

a = (1, 2, 3)
b = [1, 2, 3]

one immutable, one mutable.  please show an example of what "pointer-style
things" you would like to do.

i've read this entire thread so far, and from a practical point of view
(because that's all i really care about and what pays the bills), i really
don't understand what the problem is.  personally, i don't care about the
strict definitions of computer science terms and what "variable" or
"pointer" means.  i do care about how fast problems can be solved, how much
resources must be involved in solving that problem, and how much money can
be made/saved.  for me, python is a winner in all this area.  not having
pointers like c/c++ is such a blessing.  i can't believe anyone would even
suggest that pointers and/or doing things with pointers be brought into
python.  ok... one more time... let's bring this conversation down to
something practical.   please show an example of pointer-style functionality
in any language that is missing/awkward/complicated in python.  i'm not an
expert in python, i'm just very curious to understand what the true
practical issue is.

thanks,

bryan

> In short, you are showing evidence of the use of pointers internally
> within Python, but that is not the same as providing pointer-like
> semantics.
>






More information about the Python-list mailing list