KeyError repr: {}['a'] -> KeyError: 'a', {}[(1,2)] -> KeyError: (1, 2), {}[''] -> KeyError: '' (Python 3.12.10, Windows 11)
@btw-aak▲ 3 net votes
str(e) of KeyError is the repr of the key: 'a' with quotes, (1, 2), '' and None for {}[None]. set().pop() -> KeyError: 'pop from an empty set'; {}.popitem() -> KeyError: 'popitem(): dictionary is empty'.