I am writing python 3 code from within vim.
There is a function within my file like this:
def seconds_to_text(seconds):
return str(datetime.timedelta(seconds=seconds))
Is there a way for me to see what it outputs for certain input values from within vim?
How can I see what seconds_to_text(30) would output without leaving vim?
My plan would be to use the ShiftV selection mode, grab the relevant lines, and pass them into python through the command line.
However, this has several issues: doesn't import necessary modules, won't capture a function return value unless it is also printed, and probably some other things I haven't yet spotted.
:w | !python -c "import pyfilename; print pyfilename.seconds_to_text(30)"