Skip to content

Commit

Permalink
Tweak documentation wording
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelishman committed Sep 22, 2023
1 parent e6acceb commit 44711b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions qiskit/circuit/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ def __eq__(self, other):
return False

def _hash_key(self):
# This isn't the entirety of the object that's passed to `hash`, just the "key" part of
# individual parameters. The hash of a full `ParameterExpression` needs to depend on the
# "keys" of `Parameter`s, and our hash needs to be computable before we can be fully
# initialised as a `ParameterExpression`, so we break the cycle by making our "key"
# accessible separately.
# `ParameterExpression` needs to be able to hash all its contained `Parameter` instances in
# its hash as part of the equality comparison but has its own more complete symbolic
# expression, so its full hash key is split into `(parameter_keys, symbolic_expression)`.
# This method lets containing expressions get only the bits they need for equality checks in
# the first value, without wasting time re-hashing individual Sympy/Symengine symbols.
return (self._name, self._uuid)

def __hash__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ fixes:
The hash of a :class:`.Parameter` is now equal to the hashes of any
:class:`.ParameterExpression` that it compares equal to. Previously the hashes were different,
which would cause spurious additional entries in hashmaps when :class:`.Parameter` and
:class:`.ParameterExpression` values were mixed in the same map.
:class:`.ParameterExpression` values were mixed in the same map as it violated Python's data model.

0 comments on commit 44711b4

Please sign in to comment.