diff --git a/tutorials/key_differences_between_python_2_and_3.html b/tutorials/key_differences_between_python_2_and_3.html index d4311cb..a839b1a 100644 --- a/tutorials/key_differences_between_python_2_and_3.html +++ b/tutorials/key_differences_between_python_2_and_3.html @@ -1848,7 +1848,7 @@ generators 2.3
Very trivial, and the change in the print-syntax is probably the most widely known change, but still it is worth mentioning: Python 2's print function doesn't require the parantheses for invoking the print function (it wouldn't choke on them).
In contrast, Python 3 would raise a SyntaxError
if we called the print function the Python 2-way without the parentheses.
I think this change in Python 3 makes sense in terms of consistency, since it is the common way in Python to invoke function calls with its parentheses.
+Very trivial, and the change in the print-syntax is probably the most widely known change, but still it is worth mentioning: Python 2's print statement has been replaced by the print()
function, meaning that we have to wrap the object that we want to print in parantheses.
Python 2 doesn't have a problem with additional parantheses, but in contrast, Python 3 would raise a SyntaxError
if we called the print function the Python 2-way without the parentheses.
Note:
+Printing "Hello, World" above via Python 2 looked quite "normal". However, if we have multiple objects inside the parantheses, we will create a tuple, since print
is a "statement" in Python 2, not a function call.
print 'Python', python_version()
+print('a', 'b')
+print 'a', 'b'
+