Reputation: 11
I see the only difference in this
module, Python3 has wrapped parenthesizes (, )
for the print function. I noticed an inconsistency in lengths of that module in two different python versions.
import this; print(len(open(this.__file__).read()))
# 1003
len(open('/usr/lib/python2.7/this.py').read())
# 1002
These are the outputs in python3x version. If the only difference is print function with parenthesizes, why the output is not 1004 and it is 1003?
Upvotes: 0
Views: 59
Reputation: 4365
This isn't an inconsistency. The final line of the file in Python 2 is:
print "".join([d.get(c, c) for c in s])
The file in Python 3:
print("".join([d.get(c, c) for c in s]))
Note how the first (
replaces the space between the print
and string. The )
is the only added character.
Upvotes: 2