anything like C++ references?

Adam Ruth owski at
Wed Jul 16 04:04:44 CEST 2003

In <qlq8hv8e7a5177o250c2fhvg9hv2lhfa15 at> Stephen Horne  wrote:
> On 15 Jul 2003 10:45:10 -0700, owski at (Adam Ruth) wrote:
>>I came to Python from Ada, and all I have to say is:  Pointer-like
>>semantics are evil.  They're worse than goto's, they're deadly,
>>damaging, and should be avoided at all costs.
>>They're an unhappy necessity, akin to stop-lights.  You need them
>>because roads intersect, but if roads don't intersect, don't use them!
> Absolutely true. And the worst thing you can do when you really can't
> avoid pointers is to obscure the issue even more by disguising them as
> something else.

I assume that you're referring to people 'faking' pointer in Python (
such as wrapping variables in lists, etc.)  I'd ammend your statement to 

And the worst thing you can do is to obscure the issue even more by 
disguising them as something else, WHEN YOU DON'T REALLY HAVE TO.

In Python, there is no situation where "you really can't avoid pointers".  
It's only when you program C or C++ in Python that you think you can't 
avoid pointers.  There are much better idioms to achieve the desired 

> The biggest problems with pointers relate to things with pointer math,
> pointers to deleted objects etc. These things need not exist in a
> scripting language that provides pointers - pointers don't have to be
> implemented using store addresses. That is just a concept from C, C++,
> Pascal, Ada etc - not something I want to see imitated. If pointers
> can be created that refer to given objects, and if pointers can be
> dereferenced, that is actually enough to support indirect referencing.

It's actually also unnecessary in Python.

Adam Ruth 

More information about the Python-list mailing list