Looking at the source code of pstats I see this syntax:
print >> self.stream, "in %.3f seconds" % self.total_tt
print >> self.stream
What is this syntax, how is it called and how to use it? I have never seen it before, nor seen it in any of the Python books/tutorials I have read.
If you mean the
>>, that’s the Python 2.x syntax for writing to a file-like other thansys.stdoutwithprint. It’s defined in the Python docs, 6.6. The print statement and has been around since at least Python 2.5 (and I think earlier).This syntax has been replaced with a
filekwarg to theprintfunction in Python 3.0.