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 -PEP 255: Simple Generators +PEP 255: Simple Generators @@ -1861,7 +1861,7 @@ division 3.0 -<PEP 238: Changing the Division Operator +PEP 238: Changing the Division Operator @@ -1927,7 +1927,7 @@ unicode_literals
-In [3]: +In [1]:
@@ -1972,8 +1972,8 @@ In [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.

@@ -2110,6 +2110,51 @@ In [3]:
+ +
+
+
+
+
+

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.

+
+
+
+
+
+
+In [4]: +
+
+
+
print 'Python', python_version()
+print('a', 'b')
+print 'a', 'b'
+
+ +
+
+
+ +
+
+ + +
+
+
+Python 2.7.6
+('a', 'b')
+a b
+
+
+
+
+ +
+
+