Python: Functions on Class / Object

By Xah Lee. Date: .

Useful functions on object

The following are useful functions on objects.

getattr[obj, name]
Return the value of a attribute.
hasattr[obj, name]
Check if attribute exist.
setattr[obj, name, val]
Set a attribute.
delattr[obj, name]
Delete a attribute.
issubclass(a, b)
Return true if a is a subclass of b.
isinstance(obj, class)
Return true if obj is a instance of class.

Python. Class and Object