references / aliases in Python

Jonathan P. jbperez808 at
Wed Jan 15 00:44:53 CET 2003


I couldn't exactly follow Steve Holden's example:

    function(args).dict[index][index].a = 21
    function(args).dict[index][index].b = 42
    function(args).dict[index][index].c = 63

But the idea of references did get through because I was 
trying to do something similar.  I was wondering if there 
was a way to get true references in Python ala below:

>>> class A: 
      def __init__(self):
      def f1(self):
        ref1=&self.long_descriptive_name1  # hypothetical address-of operator
        if (*ref1)>(*ref2)+1: (*ref1)=(*ref2) 
        # hypothetical dereference operator

replacing the long and rather unreadable (in practice it often
gets much worse than shown below):
      if self.long_descriptive_name1>self.long_descriptive_name2+1: 

Is there a way to get aliases without having to add a pointer 
type + referencing / dereferencing operators to Python?  What
exactly is the Python philosophy regarding pointer types and 
referencing / dereferencing?

More information about the Python-list mailing list