The base class `_eval_commutator` already has class based dispatch built in. See `sho1d.py` for examples of how to define the `_eval_commutator_Class` methods instead rather than doing a manual chain of `isinstance` tests.