to_iterable_of_len

  • full name: tenpy.tools.misc.to_iterable_of_len

  • parent module: tenpy.tools.misc

  • type: function

tenpy.tools.misc.to_iterable_of_len(a, L)[source]

If a is a non-string iterable of length L, return a, otherwise return [a]*L.

Raises ValueError if a is already an iterable of different length.