21 Jul
2020
21 Jul
'20
12:06 p.m.
On Tue, Jul 21, 2020, 5:48 AM Gerrit Holl
On Sat, 18 Jul 2020 at 18:31, MRAB
wrote: [snip] I haven't followed this thread for a while, but, to me, it seems that the simplest option would be to pass the keyword arguments as a dict:
obj[a, b:c, x=1] does obj.__getitem__((a, slice(b, c)), dict(x=1))
If there are no keyword arguments, then there's no dict.
Could the entire argument be turned into a namedtuple?
The original rejected PEP had some good reasons for not going with a namedtuple. I haven't read it in a while but I suggest considering them. The biggest one being, a new class would have to be created and instantiated for every indexing operation.