From 068da2671264a913960af2ee8de186c38a30f2d7 Mon Sep 17 00:00:00 2001 From: jpt Date: Tue, 19 Mar 2024 09:02:10 +0100 Subject: [PATCH] n8n.jpt.land: Added python-3-vs-python-2 impress presentation --- python-3-vs-python-2/index.html | 124 ++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 python-3-vs-python-2/index.html diff --git a/python-3-vs-python-2/index.html b/python-3-vs-python-2/index.html new file mode 100644 index 0000000..c8e7860 --- /dev/null +++ b/python-3-vs-python-2/index.html @@ -0,0 +1,124 @@ + + + + + +Python 3 vs Python 2 Presentation + +
+ +
+

Introduction to Python 3 vs Python 2 🐍

+

Python 2 released in 2000; legacy code, no longer supported after 2020.

+

Python 3 introduced in 2008; the future of Python, ongoing support.

+

Key differences in syntax, libraries, and error handling.

+
+ + + + + +
+

Integer Division ➗

+

Python 2: Dividing two integers results in an integer. 3 / 2 = 1

+

Python 3: Division results in a float. 3 / 2 = 1.5

+

Use // in Python 3 for integer division.

+
+ + +
+

Unicode Support 🌍

+

Python 2: Strings are ASCII by default.

+

Python 3: Strings are Unicode by default.

+

Better support for non-English languages and symbols in Python 3.

+
+ + +
+

Syntax Changes 🔄

+

Python 2: xrange(), print, except Exception, e:

+

Python 3: range(), print(), except Exception as e:

+

More intuitive and consistent syntax in Python 3.

+
+ + +
+

Library Changes 📚

+

Python 2: Libraries may not be compatible with Python 3.

+

Python 3: A large number of Python 2 libraries have been updated or replaced.

+

Improved and more modern standard library in Python 3.

+
+ + +
+

Error Handling 🚫

+

Python 2: Less strict about mixing types (e.g., bytes/str).

+

Python 3: Strict type checking, leading to fewer subtle bugs.

+
+ + +
+

Conclusion & Migration Tips 🎯

+

Python 3 offers significant improvements and future-proofing.

+

Migrating from Python 2 to 3 requires careful consideration but is encouraged for long-term projects.

+

Use tools like 2to3 for code translation and testing.

+
+ + +
+

Resources & Further Reading 📖

+

Python.org documentation

+

"Porting to Python 3" guide

+

Online tutorials and forums

+
+
+ + +