Re: Pointer variables possible?

Mark C. Carroll (carroll@stimpy.eecis.udel.edu)
07 Apr 1994 18:09:40 GMT

>>>>> "Bill" == Bill Baker <baker@spk.hp.com> writes:
In article <Cnsn6q.1pL@spk.hp.com> baker@spk.hp.com (Bill Baker) writes:

Bill> I have come upon a situation that I feel would benefit from
Bill> storing pointers to several items in a list type that would
Bill> enable insertions at these points. I don't know much about the
Bill> internal workings of python and whether this would be possible
Bill> but with C it would only require the use of an address pointer.
Bill> I have looked through the python references I have but being new
Bill> to python I don't know if this is possible.

This post is an example of one of my personal pet peeves, so I'm going
to vent a little bit :-)

When someone comes to a new language, it's a common mistake to try to
force that language to fit the mold of the languages that they're
already familiar with.

Python isn't C. It's a very different language. Don't force it to be
C. Don't write C programs in Python. Write python in Python.

You didn't give enough information about your problem for any of the
readers of this group to be able to suggest a Python-esque solution to
your problem. But I can tell you with almost *complete* certainty that
you're going about it the wrong way.

Python allows you to create new data structures. If you need a list
where you're able to return a handle on a position where an insertion
is going to occur, you can implement it using a class.

Describe the problem you're trying to solve, and the people of this
list will be glad to show you a pythonesque solution.

<MC>

--