I tried printing a variable in a python code that I have and I got this:
[array([ 1., 0.]), array([ 0., 1.]), array([ 0., 1.]), array([ 1., 0.])]
What does this code snippet mean?
This seems to be a list containing Numpy arrays, although without more information I can't assure that.
>>> from numpy import array
>>> my_var = [array([ 1., 0.]), array([ 0., 1.]), array([ 0., 1.]), array([ 1., 0.])]
>>> print(my_var)
[array([ 1., 0.]), array([ 0., 1.]), array([ 0., 1.]), array([ 1., 0.])]
>>> print(type(my_var))
<type 'list'>
>>> print(type(my_var[0]))
<type 'numpy.ndarray'>
If this is the same array as the one in the built in array module, then the constructor requires a typecode in order to properly initialize the object , in your case like so : array('d', [1. ,0.]) . Are you sure the code you have here works ? Assuming it could infer the typecode from the values passed into the initializer list, you would have a list of arrays
repr, which the built-in Python arrays don't do. They would get represented as [array('d', [1.0, 0.0]), ...]