pointer

Jeff Shannon jeff at ccvcorp.com
Wed Apr 10 15:54:29 EDT 2002


In article <a921d2$2og$1 at news.mathworks.com>, 
jmarshal at mathworks.com says...
> Jeff Shannon <jeff at ccvcorp.com> wrote:
> > In article <a8vk7h$apk$1 at news.mathworks.com>, 
> > jmarshal at mathworks.com says...
> >> 
> >> To emulate the semantics of pointers, I like using single-element
> >> lists, as some others have suggested.
> 
> > I prefer to *not* emulate the semantics of pointers.  If I have 
> > data that needs to be changed in such a way, I'll put it in a 
> > class and change it through a method.  If I wanted to fiddle with 
> > pointers, I'd program in C.
> 
> But then you weren't the one asking about pointers in Python :)
> 
> I do agree though.  Other non-pointery approaches are cleaner.

Well, my point was exactly that doing pointery things in Python 
is generally a bad idea, regardless of whether it was being 
asked about or not.  There are other, better ways to do those 
same things, in a non-pointery fashion, and if one is truly 
attached to pointer semantics, then one should not use Python.  

Sometimes, when someone asks "How do I do this?", the appropriate 
response really is "Don't do that!"  :)

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list