gadgets.lca¶
Lastest Common Ancestor of Two Classes.
- pythonic_fp.gadgets.lca.latest_common_ancestor(cls1: type, cls2: type) type | Never ¶
Find the least upper bound in the inheritance graph of two classes.
Warning
This function can fail with a TypeError. Some error messages seen are
multiple bases have instance lay-out conflict
type ‘bool’ is not an acceptable base type
This happens frequently when the function is given Python builtin types.
- Parameters:
cls1 – first class
cls2 – second class
- Returns:
least common ancestor base class of cls1 and cls2
- Raises:
TypeError – theoretically only from inspect.getmto