Is there a way to run my current python code in vim without making any changes to the file? Normally, when I want to test my code from within vim, I would execute this:
:w !python
However, this overrides the current file I am editing. Often, I add print statements or comment stuff out to see why my code isn't working. I do not want such changes to overwrite a previous version of whatever .py file I'm currently working on. Is there a way to do so? Perhaps a combination of saving to a temporary file and deleting it afterwards?

:wsave firstly, then:!python %(%-> filename) and you will get the result.:w !python3I get a python error. vim help indicates this should either feed the buffer into the external command or write to a temp file and feed that to the external command.