When testing or creating a new function, I often like to print every line of code that is happening so that I can see how every line is processing.
Is there a library or method that can serve this purpose? I'm looking for something more convenient so I don't have to type print after every line.
For example, instead of writing this function
def test_func():
l = range(10)
print l
l = zip(l,range(30,40))
print l
l = dict(l)
print l
I'd like to write this without writing print, yet still get every line printed
def test_func():
l = range(10)
l = zip(l,range(30,40))
l = dict(l)
Perhaps there is a Python decorator or something for this?
Aucun commentaire:
Enregistrer un commentaire