def __add__(self, other):
    'The addition operation between Observables/Tensors/qml.Hamiltonian objects.'
    if isinstance(other, (Observable, Tensor)):
        return qml.Hamiltonian([1, 1], [self, other], simplify=True)
    if isinstance(other, qml.Hamiltonian):
        return (other + self)
    raise ValueError(f'Cannot add Observable and {type(other)}')
The addition operation between Observables/Tensors/qml.Hamiltonian objects.
def __add__(self, other):
    
    if isinstance(other, (Observable, Tensor)):
        return qml.Hamiltonian([1, 1], [self, other], simplify=True)
    if isinstance(other, qml.Hamiltonian):
        return (other + self)
    raise ValueError(f'Cannot add Observable and {type(other)}')