反復処理ユーティリティ
qiskit_addon_cutting.utils.iteration
反復ユーティリティ。
unique_by_id
unique_by_id(iterable, /)
iterable 内の一意なオブジェクトを ID で返す。
>>> a = {0}
>>> list(unique_by_id([a, a]))
[{0}]
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~collections.abc.ValuesView\``>>> list(unique_by_id([a, a.copy()]))
[{0}, {0}]パラメーター
iterable (Iterable)
戻りの型
unique_by_eq
unique_by_eq(iterable, /)
iterable 内の一意なオブジェクトを等号で返す。
この関数は、(i)オブジェクトの数が少なく、(ii)オブジェクトがハッシュ可能であることが保証されていない場合にのみ適切である。 そうでなければ、 dict か set が良い選択だ。
この関数は、すべての要素のペアの間で比較を行う可能性があるため、 dict や set とは対照的に、最悪の場合、 の時間で実行される。
>>> a = {0}
>>> list(unique_by_eq([a, a]))
[{0}]
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`list\``>>> list(unique_by_eq([a, a.copy()]))
[{0}]パラメーター
iterable (Iterable)
戻りの型
このページは役に立ちましたか?
バグや誤字の報告、またはコンテンツの要求はGitHubで行ってください。