8 results
tagged
snippets
You can make a more compact implementations with help of the reduce builtin function:
def rec_getattr(obj, attr):
return reduce(getattr, attr.split(”.”), obj)