Re: Pointer variables possible?
Steven Miale (smiale@cs.indiana.edu)
Thu, 7 Apr 1994 12:53:05 -0500
In article <CnsyqC.J84@murdoch.acc.virginia.edu>,
Steven D. Majewski <sdm7g@elvis.med.Virginia.EDU> wrote:
>In article <Cnsn6q.1pL@spk.hp.com>, Bill Baker <baker@spk.hp.com> wrote:
>>I have come upon a situation that I feel would benefit from storing pointers
>>to several items in a list type that would enable insertions at these points.
>>I don't know much about the internal workings of python and whether this
>>would be possible but with C it would only require the use of an address
>>pointer. I have looked through the python references I have but being new
>>to python I don't know if this is possible.
>
>Python does not have pointers, but references to mutable objects
>ARE references to the OBJECT, and not the VALUE.
Maybe what we need are Scheme-style "boxes." They provide a form
of "call-by-reference", like so:
> (set! x (box 3))
> (define make-it-four
(lambda (foo)
(set-box! foo 4)))
> (make-it-four x)
> (unbox x)
4
Steve
--
Steven Miale - smiale@cs.indiana.edu | Don't blame me -
Indiana University, Bloomington, IN | I voted Libertarian.