n8n.jpt.land: Added python-3-vs-python-2 impress presentation

main
jpt 2024-03-19 09:10:17 +01:00
parent 068da26712
commit ce1097e630
1 changed files with 121 additions and 121 deletions

View File

@ -1,10 +1,11 @@
<html lang="en">
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy">
<title>Python 3 vs Python 2 Presentation</title>
<style>
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy">
<title>Python Versions Presentation</title>
<style>
body {
background-color: #fff;
font-family: Arial, sans-serif;
@ -47,78 +48,77 @@
height: auto;
margin-top: 20px;
}
</style>
<div id="impress">
<!-- Introduction Slide -->
<div id="intro-slide" class="step" data-scale="1" data-x="0" data-y="0">
<h1>Introduction to Python 3 vs Python 2 🐍</h1>
<p><strong>Python 2</strong> released in 2000; legacy code, no longer supported after 2020.</p>
<p><strong>Python 3</strong> introduced in 2008; the future of Python, ongoing support.</p>
<p>Key differences in syntax, libraries, and error handling.</p>
</style>
</head>
<body>
<div id="impress">
<div id="slide1" class="step" data-x="0" data-y="0">
<h1>Introduction to Python Versions</h1>
<p>Brief History of Python<br>
Python 2 release in 2000<br>
Python 3 release in 2008<br>
Key differences aim to make Python more powerful and easier to use</p>
</div>
<!-- Print Function Slide -->
<div id="print-function-slide" class="step" data-scale="1" data-x="1000" data-y="0">
<h1>Print Function 🖨️</h1>
<p><strong>Python 2</strong>: Print statement <code>print "Hello, world"</code></p>
<p><strong>Python 3</strong>: Print function <code>print("Hello, world")</code></p>
<div id="slide2" class="step" data-x="1000" data-y="-500">
<h1>Syntax Differences</h1>
<p>Print function<br>
Python 2: <code>print "Hello, world!"</code><br>
Python 3: <code>print("Hello, world!")</code><br>
Integer division<br>
Python 2: <code>3/2 = 1</code><br>
Python 3: <code>3/2 = 1.5</code></p>
</div>
<!-- Integer Division Slide -->
<div id="integer-division-slide" class="step" data-scale="1" data-x="2000" data-y="0">
<h1>Integer Division ➗</h1>
<p><strong>Python 2</strong>: Dividing two integers results in an integer. <code>3 / 2 = 1</code></p>
<p><strong>Python 3</strong>: Division results in a float. <code>3 / 2 = 1.5</code></p>
<p>Use <code>//</code> in Python 3 for integer division.</p>
<div id="slide3" class="step" data-x="2000" data-y="-1000">
<h1>Unicode Support</h1>
<p>Python 2: Strings are ASCII by default. Unicode string with <code>u"unicode"</code><br>
Python 3: All strings are Unicode. Bytes type for ASCII text: <code>b"ascii"</code></p>
</div>
<!-- Unicode Support Slide -->
<div id="unicode-support-slide" class="step" data-scale="1" data-x="3000" data-y="0">
<h1>Unicode Support 🌍</h1>
<p><strong>Python 2</strong>: Strings are ASCII by default.</p>
<p><strong>Python 3</strong>: Strings are Unicode by default.</p>
<p>Better support for non-English languages and symbols in Python 3.</p>
<div id="slide4" class="step" data-x="3000" data-y="-1500">
<h1>Library Changes</h1>
<p>Changes in standard library<br>
Python 2: <code>urllib</code>, <code>urllib2</code>, <code>httplib</code><br>
Python 3: Unified under <code>urllib</code> package<br>
Range function<br>
Python 2: <code>xrange()</code> for efficient looping<br>
Python 3: <code>range()</code> is now like <code>xrange()</code></p>
</div>
<!-- Syntax Changes Slide -->
<div id="syntax-changes-slide" class="step" data-scale="1" data-x="4000" data-y="0">
<h1>Syntax Changes 🔄</h1>
<p><strong>Python 2</strong>: <code>xrange()</code>, <code>print</code>, <code>except Exception, e:</code></p>
<p><strong>Python 3</strong>: <code>range()</code>, <code>print()</code>, <code>except Exception as e:</code></p>
<p>More intuitive and consistent syntax in Python 3.</p>
<div id="slide5" class="step" data-x="4000" data-y="-2000">
<h1>Error Handling</h1>
<p>Syntax for exception handling<br>
Python 2: <code>except IOError, e:</code><br>
Python 3: <code>except IOError as e:</code></p>
</div>
<!-- Library Changes Slide -->
<div id="library-changes-slide" class="step" data-scale="1" data-x="5000" data-y="0">
<h1>Library Changes 📚</h1>
<p><strong>Python 2</strong>: Libraries may not be compatible with Python 3.</p>
<p><strong>Python 3</strong>: A large number of Python 2 libraries have been updated or replaced.</p>
<p>Improved and more modern standard library in Python 3.</p>
<div id="slide6" class="step" data-x="5000" data-y="-2500">
<h1>Iterators and Generators</h1>
<p>Enhancements in iteration<br>
Python 3 introduces new behavior for dict methods <code>.keys()</code>, <code>.items()</code>, and <code>.values()</code> which return views instead of lists</p>
</div>
<!-- Error Handling Slide -->
<div id="error-handling-slide" class="step" data-scale="1" data-x="6000" data-y="0">
<h1>Error Handling 🚫</h1>
<p><strong>Python 2</strong>: Less strict about mixing types (e.g., bytes/str).</p>
<p><strong>Python 3</strong>: Strict type checking, leading to fewer subtle bugs.</p>
<div id="slide7" class="step" data-x="6000" data-y="-3000">
<h1>End of Life</h1>
<p>Python 2 end of life in 2020<br>
No more official support or updates<br>
Encouragement to migrate to Python 3 for security and latest features</p>
</div>
<!-- Conclusion Slide -->
<div id="conclusion-slide" class="step" data-scale="1" data-x="7000" data-y="0">
<h1>Conclusion & Migration Tips 🎯</h1>
<p>Python 3 offers significant improvements and future-proofing.</p>
<p>Migrating from Python 2 to 3 requires careful consideration but is encouraged for long-term projects.</p>
<p>Use tools like <code>2to3</code> for code translation and testing.</p>
<div id="slide8" class="step" data-x="7000" data-y="-3500">
<h1>Migrating from Python 2 to Python 3</h1>
<p>Tools like <code>2to3</code> can help in converting Python 2 code to Python 3<br>
Considerations for maintaining compatibility<br>
Importance of testing during migration</p>
</div>
<!-- Resources Slide -->
<div id="resources-slide" class="step" data-scale="1" data-x="8000" data-y="0">
<h1>Resources & Further Reading 📖</h1>
<p>Python.org documentation</p>
<p>"Porting to Python 3" guide</p>
<p>Online tutorials and forums</p>
<div id="slide9" class="step" data-x="8000" data-y="-4000">
<h1>Conclusion</h1>
<p>Python 3 offers significant improvements and is the future of Python<br>
Transitioning to Python 3 is essential for access to new features and continued support</p>
</div>
</div>
<script src="https://impress.github.io/impress.js/js/impress.js"></script>
<script>impress().init()</script>
<div id="slide10" class="step" data-x="9000" data-y="-4500">
<h1>Resources</h1>
<p>Official Python documentation</p>
</div>
</div>
<script src="https://impress.github.io/impress.js/js/impress.js"></script>
<script>
impress().init();
</script>
</body>
</html>