Curiosity Python 2.7 and print() from Python 3.6
First Published: .
I lead a project where I decided to go with Python 2.7, for the wide compatibility across all the Servers around.
With RHEL now supporting Python 3 as well, it doesn’t make much sense any more, as all the major brands do support Python 3 directly.
I saw it coming so in my Coding Style Guide for my Team I explained that we will use print(“”) which is the required way to proceed with Python 3, as opposite to print “whatever” from Python 2. Noye Python 2 supports both methods.
But today something unexpected appeared in the Tests. One line of code was making a print of ().
The line of code was:
print()
And not
print("")
And the curiosity is that if you do print() in Python 2.7 it outputs ().
Rules for writing a Comment