John Henry wrote: > Hi list, > > Just to make sure I understand this. > > Since there is no "pointer" type in Python, I like to know how I do > that. > > For instance, if I do: > > ...some_huge_list is a huge list... > some_huge_list[0]=1 > aref = some_huge_list > aref[0]=0 > print some_huge_list[0] > > we know that the answere will be 0. In this case, aref is really a > reference. > > But what if the right hand side is a simple variable (say an int)? Can > I "reference" it somehow? Should I assume that: > > aref = _any_type_other_than_simple_one > > be a reference, and not a copy? > Yes. Attributes are always object references. The assignment is actually the binding of a specific object to a name in some namespace, (r to an element of a sequence or other container object.
This applies *whatever* the type of the RHS experession: the expression is evaluated to yield an object, and a reference to the object is stored in the name or container element. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list