4 ms·
`methodcaller` (https://github.com/python/cpython/blob/6a6bcf16370beff2e0d1a034661654d5c335b5ee/Lib/operator.py#L296 https://github.com/python/cpython/blob/6a6b
by icegreentea2 5y ago
`methodcaller` (https://github.com/python/cpython/blob/6a6bcf16370beff2e0d1a034661654d5c335b5ee/Lib/operator.py#L296 https://github.com/python/cpython/blob/6a6bcf16370beff2e0d1a...) is just syntax sugar around `getattr` + a function call which is just syntax sugar + default implementation of `__getattr__` which is basically exactly what it looks like your lua example is (I'm not that familiar with lua).
Actually, I didn't even know about `methodcaller` till I read this blogpost, so I would have implemented your example in python as: `getattr(table, string)(...)`.