HasLength#

qualtran.symbolics.HasLength

Symbolic value for an object that has a length.

This is used as a “symbolic” tuple. The length can either be a positive integer or a sympy expression. For example, if a bloq attribute is a tuple of ints, we can use the type:

values: Union[tuple, HasLength]

For the symbolic variant of a NDArray, see Shaped.

Note that we cannot override len and return a sympy symbol because Python has special treatment for len and expects you to return a non-negative integers.

See https://docs.python.org/3/reference/datamodel.html#object.len for more details.

n

 

Methods#

is_symbolic

View source

__ne__

Check equality and either forward a NotImplemented or return the result negated.

__eq__

Method generated by attrs for class HasLength.