19.09.19 11:00, Greg Ewing пише:
Serhiy Storchaka wrote:
PyDict_Merge() is called every time when you have a call like `f(a=1, **kw)`
So would not be worth to add slots for keys (and maybe for values and items) to the tp_as_mapping structure?
Only if looking up those methods is taking a substantial proportion of time. Measurements will be needed to find out.
I withdraw my proposition. "keys" is not a dunder name, so it should be looked up in the instance, not in the class. It can't be cached.