mattrgetter
Get attributes, ignoring attribute errors.
Like :func:`operator.itemgetter` but return :const:`None` on missing
attributes instead of raising :exc:`AttributeError`.
def mattrgetter(
*attrs: string
) - > function
Get attributes, ignoring attribute errors. Like :func:operator.itemgetter but return :const:None on missing attributes instead of raising :exc:AttributeError.
Parameters
| Name | Type | Description |
|---|---|---|
| *attrs | string | A variable number of attribute names to be retrieved from the target object. |
Returns
| Type | Description |
|---|---|
function | A lambda function that, when called with an object, returns a dictionary mapping each requested attribute name to its value or None if the attribute is missing. |