-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent use of state argument in SimulationState base and derived classes #5721
Comments
+1 this was an unfortunate oversight on my part. I think "state" is better than "initial_state" (it sounds nicer when serializing) but could be convinced otherwise. |
We're at the final call for 1.0 changes - if we want this to make it in it's going to be a no-deprecation / break-with-a-hammer style change. |
I can think of adding an abstract class method new_space = self.fromQubits(qubits) instead of new_space = type(self)(qubits=qubits) # type: ignore |
Rather than adding a new method like |
We could also just delete that function. It came from a new contributor PR where I gave this as an example of something that his changes would enable, though I didn't actually intend for him to implement it. Once he did, I figured may as well keep it. But it's not used for anything AFAIK. (Though either way it would still be nice to make the arg name consistent, regardless) |
Yeah my vote is to remove the method. Even if we changed all the constructor arg names to "state" that still wouldn't work because here we'd do (Granted I still do wish that they were not called "initial_state" because that makes it necessary for the repr to call the field "initial_state" for eval(repr(x)) to work, which is weird when it's no longer the initial state. But that's a separate, smaller issue). |
Avoid constructor argument conundrum detailed in quantumlib#5721. Closes quantumlib#5721
Removing the method sounds good - #5748. |
Avoid contradictory use of the constructor `state` argument, which is required for the SimulationState base class, but unknown to its derived classes. Closes #5721
Avoid contradictory use of the constructor `state` argument, which is required for the SimulationState base class, but unknown to its derived classes. Closes quantumlib#5721
Description of the issue
pylint complains about missing
state
argument in SimulationState constructor callCirq/cirq-core/cirq/sim/simulation_state.py
Line 190 in de76121
pylint report:
The fix is not apparent, because SimulationState constructor requires the
state
argumentCirq/cirq-core/cirq/sim/simulation_state.py
Lines 44 to 54 in de76121
however
state
is not accepted by subclasses, for example, in StateVectorSimulationState:Cirq/cirq-core/cirq/sim/state_vector_simulation_state.py
Lines 321 to 330 in de76121
Cirq version
The text was updated successfully, but these errors were encountered: