anything like C++ references?
owski at hotmail.com
Thu Jul 17 00:14:12 CEST 2003
In <donn-708BC2.14330716072003 at nntp3.u.washington.edu> Donn Cave wrote:
> In article <20030716142716509-0600 at news.xmission.com>,
> Adam Ruth <owski at hotmail.com> wrote:
>> In <donn-F604B9.12121916072003 at nntp3.u.washington.edu> Donn Cave
>> > In article <20030716123907246-0600 at news.xmission.com>,
>> > OK, there really aren't any situations where you can't avoid
>> > pointers ... so you're ready with a solution to the problem
>> > I posed above?
>> As for your problem on the subscript operator, I think my solution is:
>> there's no problem. Having the get and set asymetric is preferrable,
>> in my view. For example, I use it in a number of places where I
>> cache the set operation:
> So after all it should be "there aren't any situations that I care
> about where you can't avoid pointers." That's fine, it's really
> where we all come down in the end - life is too short to worry
> about solving problems you don't care about. One should be clear
> about it, though.
> Donn Cave, donn at u.washington.edu
"there aren't any situations that I care about where you can't avoid
pointers." is certainly true. But I still believe that there aren't any
situations where the use of a pointer would provide a substantially
better solution to the non-pointer route. Any examples I've seen so far
have non-pointer implementations that are just as good or better (of
course, 'better' is a completely loaded word).
In your example, the current implementation provides for a flexibility
that doesn't exist in the pointer version. The pointer version would
provide for slightly more concise code, and possibly a slight
performance boost, but I think that the flexibility outweighs both. The
point of my response wasn't to show that there's a good way to achieve
what you're looking for without a pointer, but to show that there are
better things to be looking for, and they don't require pointers.
So, I'll change my statement to this, "there aren't any situations where
the use of a pointer would provide a significantly better solution".
More information about the Python-list