ProtocolsΒΆ

This module provides the protocols used throughout the package.

A typing.Protocol is an interface that a class can fulfill structurally, without explicitly inheriting from it. For example, any class that implements a __len__ method satisfies Sized, whether or not it says so anywhere in its class hierarchy.

The protocols here follow the same idea, each centered on a small set of dunder-style methods. A class implementing them thereby satisfies the protocol and becomes usable wherever it is expected, without any explicit registration.

Protocol

Methods

Helper functions

SupportsCommutators

_commutator_, _anti_commutator_, _double_commutator_

commutator(), anti_commutator(), double_commutator()

SupportsCommutators(*args, **kwargs)

A Protocol indicating support for efficient commutator generation.