Skip to content

Implement a way to identify CircuitOperations (operations with loops) #6570

@dkafri

Description

@dkafri

Is your feature request related to a use case or problem? Please describe.
I've been doing a lot of transformations on Circuits containing CircuitOperations. Sometimes I need to manipulate CircuitOperations. The way I nominally identify them is using isinstance(..., cirq.CircuitOperation). But it turns out this doesn't work if the CircuitOperation is contained in a cirq.TaggedOperation.

Describe the solution you'd like
Implement a function like cirq.measurement_key_objs that I can trust to always tell me if an operation is a CircuitOperation (or effectively one under the hood).

[optional] Describe alternatives/workarounds you've considered
Writing my own custom identifier that handles TaggedOperations. But am I missing something?

[optional] Additional context (e.g. screenshots)

What is the urgency from your perspective for this issue? Is it blocking important work?

P3 - I'm not really blocked by it, it is an idea I'd like to discuss / suggestion based on principle

Metadata

Metadata

Labels

good first issueThis issue can be resolved by someone who is not familiar with the codebase. A good starting issue.kind/feature-requestDescribes new functionalitytriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions