On Sun, 27 Sep 2020 at 06:27, Steven D'Aprano
As far as speed and complexity goes, I do not understand the C implementation well enough to categorically dismiss your claims, but from everything I have seen, neither is true: this should not have any significant slowdown, and the increase in complexity should be quite small.
If my understanding of the C part is correct, this will have practically zero impact on speed. The compiler will (should) be able to create BINARY_SUBSCR opcodes when it sees an invocation without keyword arguments. It will use a new opcode BINARY_SUBSCR_KW when there's a keyword argument. The only loss in performance is that the C handler for the old variant will likely end up calling the new handler with a kwarg set to NULL, so the total cost is one routine call. But I am not an expert in the C interpreter internals, so I might be wrong. -- Kind regards, Stefano Borini