anything like C++ references?

Donn Cave donn at u.washington.edu
Wed Jul 16 13:28:43 EDT 2003


In article <20030716081156943-0600 at news.xmission.com>,
 Adam Ruth <owski at hotmail.com> wrote:

> In <1058328099.572993 at yasure> Donn Cave wrote:
> > Quoth Adam Ruth <owski at hotmail.com>:
> > ....
> >| In Python, there is no situation where "you really can't avoid 
> >| pointers".  
> > 
> > That's trivially true, no such situation can exist because that
> > Python can't be coded.  I'll repeat an example that I proposed
> > a couple days ago, though:  user implemented sequences could be
> > implemented with a single simple indexing function, returning
> > a pointer/target/whatever;  Python could assign directly to that,
> > making "seq[i] = x" the same kind of operation as and automatically
> > symmetrical with "x = seq[i]".
> > 
> > It can't be done without pointers, as far as I can see.  You may not
> > care if it can be done, but I think you'd agree that "there is no
> > situation that I care about where you really can't avoid pointers"
> > would be kind of a lame version of your assertion.
> > 
> > 	Donn Cave, donn at drizzle.com
> > 
> 
> I did a quick google search and couldn't find the thread you're 
> referring to.  Could you summarize it for me? It sounds interesting.  I 
> do so love the taste of my foot in my mouth.

http://groups.google.com/groups?selm=1058154004.286325%40yasure&output=gp
lain

There isn't much more to it.  Today's assignment:  replace
the __getitem__/__setitem__ with a single function, __item__,
that the system can use to either retrieve or deposit a value.
The __item__ function must not be required to actually retrieve
or deposit the value itself.

I'm not saying it's worth it.  I do think it would be a good
thing if "seq[i] = x" were symmetrical with "x = seq[i]", and
a single indexing function would be a better sequence API, but
the overall effect of a pointer type on the language would be
unfortunate.  Python is already far too complicated.

Really I think that's the main point.  There are some useful
and relevant features that Python doesn't have and will never
have, and that's OK.  The real limitation of any programming
language tends to be its external interfaces - if you really
can't write a decent web browser in FORTRAN-IV, that's probably
the real reason, not any fundamental limitation of the language.
That doesn't mean FORTRAN-IV is a good language, it means that
its badness can't be expressed in terms of fundamental limitations,
so this question of whether you "really need" something tends to
make a poor basis for discussion.

   Donn Cave, donn at u.washington.edu




More information about the Python-list mailing list