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 than sys.stdout with print. 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 file kwarg to the print function in Python 3.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With