So I am working on some hackerrank questions and someone posted the following snippet of code as part of a solution and I was curious if someone could explain it to me please?
getattr(l, parts[0])(*(map(int, parts[1:])))
In the following thread:
Python using getattr to call function with variable parameters
Mgilson mentioned this can be done for any function/method and I became confused.
In the getattr() documentation I found no information of passing *args after the function and so was confused. Is this method generally applicable to all functions? If so could someone please provide a few basic examples and explain why this is true?
I would greatly appreciate this!