I am using a self-defined command to create an environment for my Python code that I want to show in my document. This command has been taken from redmode's answer to the following question: here.
So, I am wondering: Is there a way to include a caption or subcaption to this code snippet then? The lstlisting environment allows for this option and I would really appreciate it.
\begin{python}[caption={text}]
should work