# Getting list of operations from a function without @qml.template

**URL:** <https://discuss.pennylane.ai/t/getting-list-of-operations-from-a-function-without-qml-template/1542>\
**Category:** PennyLane Help\
**Created:** [December 9, 2021, 10:54am UTC](https://discuss.pennylane.ai/t/getting-list-of-operations-from-a-function-without-qml-template/1542 "2021-12-09T10:54:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cvjjm](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@cvjjm](https://discuss.pennylane.ai/u/cvjjm)\
**Post date:** [December 9, 2021, 10:54am UTC](https://discuss.pennylane.ai/t/getting-list-of-operations-from-a-function-without-qml-template/1542/1 "2021-12-09T10:54:49Z")

</div>

With the `@qml.template` decorator [now gone](https://github.com/PennyLaneAI/pennylane/pull/1808) I am wondering what the recommended way is to get a list of operations that would be put on the tape by a function without a reference to a device.

Essentially the new best practice to do the equivalent of this:

```auto
import pennylane as qml
@qml.template
def f():
    qml.PauliX(wires=0)
    qml.PauliY(wires=1)

print(f())
[PauliX(wires=0), PauliY(wires=0)]

```

---

<div class="post-metadata">

**Author:** ![Romain\_Moyard](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/romain_moyard/32/567_2.png) [@Romain\_Moyard](https://discuss.pennylane.ai/u/Romain_Moyard)\
**Post date:** [December 9, 2021, 4:59pm UTC](https://discuss.pennylane.ai/t/getting-list-of-operations-from-a-function-without-qml-template/1542/2 "2021-12-09T16:59:05Z")

</div>

Hi @cvjjm, the easiest way is to use a Quantum tape to register your operations. Then it is simple to print the operations registered in the tape.

```
def f():
    qml.PauliX(wires=0)
    qml.PauliY(wires=1)

with qml.tape.QuantumTape() as tape:
    f()

print(tape.operations) 

```

The output:

` [PauliX(wires=[0]), PauliY(wires=[1])]`

If you have questions about tapes, let us know!

---

<div class="post-metadata">

**Author:** ![cvjjm](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@cvjjm](https://discuss.pennylane.ai/u/cvjjm)\
**Post date:** [December 10, 2021, 11:16am UTC](https://discuss.pennylane.ai/t/getting-list-of-operations-from-a-function-without-qml-template/1542/3 "2021-12-10T11:16:24Z")

</div>

Thanks! That is all I wanted to know!
