I have a function from an external package that returns a nested group of NumPy arrays. For example, from IPython:
In [28]: out = Function()
In [29]: out
Out[29]:
[[array([ 1., 1., 0., 1., 0.])],
[array([ 4., 4., 5., 4., 5.])],
[array([ 3., 1., 0., 0., 1.])],
[array([ 3., 6., 1., 6., 4.])],
[array([ 3., 0., 1., 1., 1.])],
[array([ 3., 17., 10., 25., 23.])],
[array([ 0., 0., 0., 0., 0.])],
[array([ 0., 0., 0., 0., 0.])],
[array([ 0., 4., 2., 5., 3.])],
[array([ 0., 0., 2., 2., 2.])],
[array([ 0., 0., 0., 0., 0.])],
[array([ 0., 0., 0., 0., 0.])],
[array([ 0., 0., 0., 0., 0.])],
[array([ 0., 1., 6., 11., 15.])]]
I can assign something like:
In [30]: a = out[9]
In [31]: a
Out[31]: [array([ 0., 0., 2., 2., 2.])]
And then finally:
In [32]: b = a[0]
In [33]: b[-1]
Out[33]: 2.0
To get a specific value that comes out of that array - namely, the last value of the 9th array in the function's output. But I'd really not prefer to make a torrent of variables every time I want to reference something - is there a clean way of referencing a specific interior part of a nested array like this?