impress/python-3-vs-python-2/index.html

125 lines
4.4 KiB
HTML
Raw Permalink Normal View History

<html lang="en">
<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;
color: #000;
margin: 0;
padding: 0;
}
.step {
width: 600px;
border-radius: 10px;
padding: 40px;
color: #333;
text-align: center;
opacity: 10%;
transition: opacity 1s;
}
.step img {
opacity: 0;
transition: opacity 1s;
}
.active {
opacity: 100%;
transition: opacity 1s;
}
.active img {
opacity: 100%;
transition: opacity 1s;
}
h1 {
font-size: 2.5em;
text-shadow: 2px 2px 4px rgba(0, 0, 0, .3);
}
p {
font-size: 1.2em;
line-height: 1.4;
margin: 20px 0;
}
img {
width: 80%;
height: auto;
margin-top: 20px;
}
</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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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 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>