I have not been able to find an answer or solution to what I think must be simple, but I do not know how to do it.
Here is a cut down snip of what I am trying to do:
from array import *
def print_array(args):
print 'array =', args
print 'array name =' ?
for i in range(len(args)):
print 'index =', i, 'value =', args[i]
my_array = array('i',[1,2,3,4])
print_array(my_array)
I want to be able to print the name of the array (in this case 'my_array') within the function 'print_array' itself. I know I could pass the 'my_array' as a string argument to the 'print_array' function. But there must be a more Pythonic solution to this?