1

I have a Python list, r[], and would like to define references, or aliases to specific members of the list. This is easy to do in languages with pointers (like C or C++), but I don't see how to do this in Python.

Specifically, I'd like do something like this:

r[0] = 1

ac <=addressof> r[0]

ac = 2

Now if I evaluate r[0] I need it to be 2

Is there a way to define such a reference in Python?

C.Nivs
  • 12,353
  • 2
  • 19
  • 44

0 Answers0