Warnings abaout tensor observables

Hello! If applicable, put your complete code example down below. Make sure that your code:

  • is 100% self-contained — someone can copy-paste exactly what is here and run it to
    reproduce the behaviour you are observing
  • includes comments
import pennylane as qml

n_wires = 5
wires = list(range(n_wires))

dev = qml.device('default.qubit', wires=wires)

@qml.qnode(dev)
def circuit():
    qml.Hadamard(wires[-1])
    qml.MultiControlledX(wires=wires)
    qml.Hadamard(wires[-1])
    
    def returnManyMeasures(qubit):
        if qubit==0:
            return qml.PauliZ(0)
        if qubit>=1:
            return returnManyMeasures(qubit-1) @ qml.PauliZ(qubit)
    return qml.expval(returnManyMeasures(n_wires-1))

qml.draw_mpl(circuit)()

circuit()

If you want help with diagnosing an error, please put the full error message below:

C:\Users\Bruno\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pennylane\ops\op_math\composite.py:209: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in staticmethod() if you want to preserve the old behavior
  return self._math_op(math.vstack(eigvals), axis=0)

And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about().
Name: PennyLane
Version: 0.41.1

Hello, I would like to know if there is something I am doing wrong due to the warning or if it is something that will be updated by the library?

Hi @Bruno_S_Bezerra , welcome to the Forum!

I wouldn’t worry about this since this is a FutureWarning which seems to be coming from Python 3.13. If you use PennyLane 0.42 and Python 3.12 you probably won’t see the warning (since this is the highest Python version we officially support at the moment).

Let me know if this answers your question or if you have additional questions!