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