A
Alan G Isaac
`lst` is a nested list
`tpl` is the indexes for an item in the list
What is the nice way to retrieve the item?
(Speedy access is nice.)
I don't want to use NumPy, but I'd like somehow
to avoid an explicit loop. I did consider using
eval. E.g., eval('lst' + '[%d]'*len(tpl)%tpl).
It works but seems rather ugly. I kind of like
reduce(list.__getitem__, tpl, lst) but the
reliance on reduce remains controversial enough
to see i removed from the Python 3 built-ins ...
Thanks,
Alan Isaac
`tpl` is the indexes for an item in the list
What is the nice way to retrieve the item?
(Speedy access is nice.)
I don't want to use NumPy, but I'd like somehow
to avoid an explicit loop. I did consider using
eval. E.g., eval('lst' + '[%d]'*len(tpl)%tpl).
It works but seems rather ugly. I kind of like
reduce(list.__getitem__, tpl, lst) but the
reliance on reduce remains controversial enough
to see i removed from the Python 3 built-ins ...
Thanks,
Alan Isaac