Why does foo[‘bar’: ‘baz’] raise TypeError rather than SyntaxError? November 22, 2023 by Tarik Using the colon in an indexing operation generates a slice object, which is not hashable.