On 06/01/2021 22:03, Grant Edwards wrote:
I'm completely baffled by that. Can somebody explain how this
expression is evaluated?
self.callbacks['file->new', underline: 0]
It appears that the dict callbacks is being accessed with the key of
a tuple comprising a string and a slice.
Huh?
You're completely right:
>>> class C:
def __getitem__(self, index): return index
>>> c = C()
>>> underline = 42
>>> c["foo", underline: 0]
('foo', slice(42, 0, None))
The OP's code will most certainly fail at runtime ;)
--
https://mail.python.org/mailman/listinfo/python-list