When is it a pointer (aka reference) - when is it a copy?

John Henry john106henry at hotmail.com
Wed Sep 13 19:14:51 CEST 2006


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?

Thanks,




More information about the Python-list mailing list