On Wed, Jul 08, 2020 at 11:32:32PM +1000, Chris Angelico wrote:
>>> T = [[11, 12, 5, 2], [15, 6, 10], [10, 8, 12, 5], [12, 15, 8, 6]]
>>> print(T[1, 2])
TypeError: list indices must be integers or slices, not tuple
If you want a helper function, it's not hard to write it:
def fetch(collection,
On 08.07.20 15:09, Hans Ginzel wrote:
Why not to allow tuple as a list index?
T = [[11, 12, 5, 2], [15, 6, 10], [10, 8, 12, 5], [12, 15, 8, 6]]
print(T[1][2])
10
print(T[1, 2])
Traceback (most recent call last):
File "", line 1, in
TypeError: list indices must be integers or slices, not
On Wed, Jul 8, 2020 at 11:18 PM Hans Ginzel wrote:
>
> Why not to allow tuple as a list index?
>
> >>> T = [[11, 12, 5, 2], [15, 6, 10], [10, 8, 12, 5], [12, 15, 8, 6]]
> >>> print(T[1][2])
> 10
> >>> print(T[1, 2])
> Traceback (most recent call last):
>File "", line 1, in
> TypeError: list i