添加 DAGCircuit.get_var() (以及 get_stretch()),以与 QuantumCircuit 和 CircuitData 保持一致
作者: arthurostrauss创建于 2026年9月20日更新于 2026年9月20日
标签type: feature request
Expected behavior
Add Python methods on DAGCircuit, mirroring CircuitData / QuantumCircuit:
dag.get_var(name: str) -> expr.Var | None
dag.get_stretch(name: str) -> expr.Stretch | NoneOptionally also get_identifier(name) for symmetry with has_identifier.
Suggested semantics (matching CircuitData):
- Return the
expr.Var/expr.Stretchfor the given name, orNoneif not found. - Alternatively, support a
defaultkwarg likeQuantumCircuit.get_varfor API consistency across the stack.
内容来源: Qiskit/qiskit