I saw some Python code like: getattr(self, that)(*args). what does it mean? I see that the builtin getattr function gets called, passing the current object and that; but what is the (*args) doing after that? Does it call something with *args as parameter?
I saw some Python code like: getattr(self, that)(*args) . what does it mean? I
Share
You’re right on track.
thatis going to be the name of a method on the object.getattr()is returning that method (function) and then calling it. Because functions are first class members they can be passed around, returned, etc.