Skip to content

Should _resolve_value pass None through? #4029

@zchen088

Description

@zchen088

Is your design idea/issue related to a use case or problem? Please describe.
In some cases, we'd like to be able to resolve a parameter to None to signal that the gate should use "default behavior". Previously, None was being used to signal recursion in the parameter resolution code, but this is no longer the case, so it seems like we should be able to do this.

Describe your design idea/issue
This would be relatively simple change. In _resolve_value:

def _resolve_value(val: Any) -> Any:
, we would simply check is None and pass that on through. What I'm not sure about is, are we relying on None not being pass through anywhere else in Cirq? For example, is there code which assumes that, if the value is None, don't resolve it?

Metadata

Metadata

Assignees

Labels

area/parametersparameter resolution, parameterized gates, operationskind/design-issueA conversation around designtriage/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