I would love to be able to do
>>> A = numpy.array(((1,2),(3,4))) >>> idx = (0,0) >>> A[*idx]
and get
<
No unpacking is necessary—when you have a comma between [ and ], you are making a tuple, not passing arguments. foo[bar, baz] is equivalent to foo[(bar, baz)]. So if you have a tuple t = bar, baz you would simply say foo[t].
[
]
foo[bar, baz]
foo[(bar, baz)]
t = bar, baz
foo[t]