AlloViz.AlloViz.utils.rhasattr¶
- AlloViz.AlloViz.utils.rhasattr(obj, *attrs)[source]¶
Recursive version of the built-in hasattr
It recursively checks if the successive strings passed are attributes of the object or the object’s attribute, or the object’s attribute’s attribute… It exploits
rgetattr()
and the fact that it already returns False if any of the strings passed for the recursive search doesn’t exist as attribute.- Parameters:
- obj
Object in which to check if the first attribute passed exists.
- attrsstr
Strings to recursively use to retrieve attributes.
Examples
>>> import AlloViz >>> rgetattr = AlloViz.AlloViz.utils.rgetattr >>> rgetattr(AlloViz, "AlloViz", "utils", "rgetattr") True >>> rgetattr(AlloViz.AlloViz.utils, "rgetattr") True >>> rgetattr(AlloViz, "AlloViz", "utils", "is_attr") False