[Python] The lazy evaluation of lambda expressions causes the definition of ElementaryOperator to change unexpectedly #2426
Labels
python-lang
Anything related to the Python CUDA Quantum language implementation
As shown in this example, users can change the definition of an operator after it has been defined. While this behavior is correct according to Python's language specifications, it might lead to unexpected results for users.
In particular, if users use a
for
loop to calldefine
, users need to be careful because thefor
loop may inadvertently change the operator definitions. For example,The text was updated successfully, but these errors were encountered: