Passing to a function -- object and method names (or references)
M at a.k
Fri Jan 2 21:17:41 CET 2004
Peter Otten wrote:
>You can access attributes with the getattr() builtin.
>carGas = getattr(car, "gas")
>You can refer to a method either directly
>fun = car.drive
>or via getattr():
>fun = getattr(car, "drive")
>I've modified your example to demonstrate this.
Thank you very much, Peter! It works nicely!
More information about the Python-list