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,124 +1,124 @@
<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>
body { <style>
background-color: #fff; body {
font-family: Arial, sans-serif; background-color: #fff;
color: #000; font-family: Arial, sans-serif;
margin: 0; color: #000;
padding: 0; margin: 0;
} padding: 0;
.step { }
width: 600px; .step {
border-radius: 10px; width: 600px;
padding: 40px; border-radius: 10px;
color: #333; padding: 40px;
text-align: center; color: #333;
opacity: 10%; text-align: center;
transition: opacity 1s; opacity: 10%;
} transition: opacity 1s;
.step img { }
opacity: 0; .step img {
transition: opacity 1s; opacity: 0;
} transition: opacity 1s;
.active { }
opacity: 100%; .active {
transition: opacity 1s; opacity: 100%;
} transition: opacity 1s;
.active img { }
opacity: 100%; .active img {
transition: opacity 1s; opacity: 100%;
} transition: opacity 1s;
h1 { }
font-size: 2.5em; h1 {
text-shadow: 2px 2px 4px rgba(0, 0, 0, .3); font-size: 2.5em;
} text-shadow: 2px 2px 4px rgba(0, 0, 0, .3);
p { }
font-size: 1.2em; p {
line-height: 1.4; font-size: 1.2em;
margin: 20px 0; line-height: 1.4;
} margin: 20px 0;
img { }
width: 80%; img {
height: auto; width: 80%;
margin-top: 20px; height: auto;
} margin-top: 20px;
</style> }
<div id="impress"> </style>
<!-- Introduction Slide --> </head>
<div id="intro-slide" class="step" data-scale="1" data-x="0" data-y="0"> <body>
<h1>Introduction to Python 3 vs Python 2 🐍</h1> <div id="impress">
<p><strong>Python 2</strong> released in 2000; legacy code, no longer supported after 2020.</p> <div id="slide1" class="step" data-x="0" data-y="0">
<p><strong>Python 3</strong> introduced in 2008; the future of Python, ongoing support.</p> <h1>Introduction to Python Versions</h1>
<p>Key differences in syntax, libraries, and error handling.</p> <p>Brief History of Python<br>
</div> Python 2 release in 2000<br>
Python 3 release in 2008<br>
<!-- Print Function Slide --> Key differences aim to make Python more powerful and easier to use</p>
<div id="print-function-slide" class="step" data-scale="1" data-x="1000" data-y="0"> </div>
<h1>Print Function 🖨️</h1> <div id="slide2" class="step" data-x="1000" data-y="-500">
<p><strong>Python 2</strong>: Print statement <code>print "Hello, world"</code></p> <h1>Syntax Differences</h1>
<p><strong>Python 3</strong>: Print function <code>print("Hello, world")</code></p> <p>Print function<br>
</div> Python 2: <code>print "Hello, world!"</code><br>
Python 3: <code>print("Hello, world!")</code><br>
<!-- Integer Division Slide --> Integer division<br>
<div id="integer-division-slide" class="step" data-scale="1" data-x="2000" data-y="0"> Python 2: <code>3/2 = 1</code><br>
<h1>Integer Division ➗</h1> Python 3: <code>3/2 = 1.5</code></p>
<p><strong>Python 2</strong>: Dividing two integers results in an integer. <code>3 / 2 = 1</code></p> </div>
<p><strong>Python 3</strong>: Division results in a float. <code>3 / 2 = 1.5</code></p> <div id="slide3" class="step" data-x="2000" data-y="-1000">
<p>Use <code>//</code> in Python 3 for integer division.</p> <h1>Unicode Support</h1>
</div> <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>
<!-- Unicode Support Slide --> </div>
<div id="unicode-support-slide" class="step" data-scale="1" data-x="3000" data-y="0"> <div id="slide4" class="step" data-x="3000" data-y="-1500">
<h1>Unicode Support 🌍</h1> <h1>Library Changes</h1>
<p><strong>Python 2</strong>: Strings are ASCII by default.</p> <p>Changes in standard library<br>
<p><strong>Python 3</strong>: Strings are Unicode by default.</p> Python 2: <code>urllib</code>, <code>urllib2</code>, <code>httplib</code><br>
<p>Better support for non-English languages and symbols in Python 3.</p> Python 3: Unified under <code>urllib</code> package<br>
</div> Range function<br>
Python 2: <code>xrange()</code> for efficient looping<br>
<!-- Syntax Changes Slide --> Python 3: <code>range()</code> is now like <code>xrange()</code></p>
<div id="syntax-changes-slide" class="step" data-scale="1" data-x="4000" data-y="0"> </div>
<h1>Syntax Changes 🔄</h1> <div id="slide5" class="step" data-x="4000" data-y="-2000">
<p><strong>Python 2</strong>: <code>xrange()</code>, <code>print</code>, <code>except Exception, e:</code></p> <h1>Error Handling</h1>
<p><strong>Python 3</strong>: <code>range()</code>, <code>print()</code>, <code>except Exception as e:</code></p> <p>Syntax for exception handling<br>
<p>More intuitive and consistent syntax in Python 3.</p> Python 2: <code>except IOError, e:</code><br>
</div> Python 3: <code>except IOError as e:</code></p>
</div>
<!-- Library Changes Slide --> <div id="slide6" class="step" data-x="5000" data-y="-2500">
<div id="library-changes-slide" class="step" data-scale="1" data-x="5000" data-y="0"> <h1>Iterators and Generators</h1>
<h1>Library Changes 📚</h1> <p>Enhancements in iteration<br>
<p><strong>Python 2</strong>: Libraries may not be compatible with Python 3.</p> 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 3</strong>: A large number of Python 2 libraries have been updated or replaced.</p> </div>
<p>Improved and more modern standard library in Python 3.</p> <div id="slide7" class="step" data-x="6000" data-y="-3000">
</div> <h1>End of Life</h1>
<p>Python 2 end of life in 2020<br>
<!-- Error Handling Slide --> No more official support or updates<br>
<div id="error-handling-slide" class="step" data-scale="1" data-x="6000" data-y="0"> Encouragement to migrate to Python 3 for security and latest features</p>
<h1>Error Handling 🚫</h1> </div>
<p><strong>Python 2</strong>: Less strict about mixing types (e.g., bytes/str).</p> <div id="slide8" class="step" data-x="7000" data-y="-3500">
<p><strong>Python 3</strong>: Strict type checking, leading to fewer subtle bugs.</p> <h1>Migrating from Python 2 to Python 3</h1>
</div> <p>Tools like <code>2to3</code> can help in converting Python 2 code to Python 3<br>
Considerations for maintaining compatibility<br>
<!-- Conclusion Slide --> Importance of testing during migration</p>
<div id="conclusion-slide" class="step" data-scale="1" data-x="7000" data-y="0"> </div>
<h1>Conclusion & Migration Tips 🎯</h1> <div id="slide9" class="step" data-x="8000" data-y="-4000">
<p>Python 3 offers significant improvements and future-proofing.</p> <h1>Conclusion</h1>
<p>Migrating from Python 2 to 3 requires careful consideration but is encouraged for long-term projects.</p> <p>Python 3 offers significant improvements and is the future of Python<br>
<p>Use tools like <code>2to3</code> for code translation and testing.</p> Transitioning to Python 3 is essential for access to new features and continued support</p>
</div> </div>
<div id="slide10" class="step" data-x="9000" data-y="-4500">
<!-- Resources Slide --> <h1>Resources</h1>
<div id="resources-slide" class="step" data-scale="1" data-x="8000" data-y="0"> <p>Official Python documentation</p>
<h1>Resources & Further Reading 📖</h1> </div>
<p>Python.org documentation</p> </div>
<p>"Porting to Python 3" guide</p> <script src="https://impress.github.io/impress.js/js/impress.js"></script>
<p>Online tutorials and forums</p> <script>
</div> impress().init();
</div> </script>
<script src="https://impress.github.io/impress.js/js/impress.js"></script> </body>
<script>impress().init()</script> </html>