<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Real Python</title>
  <link href="https://realpython.com/atom.xml" rel="self"/>
  <link href="https://realpython.com/"/>
  <updated>2023-09-19T14:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>Design and Guidance: Object-Oriented Programming in Python</title>
      <id>https://realpython.com/courses/solid-principles-python/</id>
      <link href="https://realpython.com/courses/solid-principles-python/"/>
      <updated>2023-09-19T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about the SOLID principles, which are five well-established standards for improving your object-oriented design in Python. By applying these principles, you can create object-oriented code that is more maintainable, extensible, scalable, and testable.</summary>
      <content type="html">
        &lt;p&gt;Writing good object-oriented code is about more than just how to write the
syntax. Knowing when and when not to use it, as well as guiding principles
behind &lt;strong&gt;object-oriented design&lt;/strong&gt; will help you write better code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The objected-oriented approach in &lt;strong&gt;Python vs other languages&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Cases in which you &lt;strong&gt;shouldn&amp;rsquo;t use&lt;/strong&gt; classes in Python&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alternatives to inheritance&lt;/strong&gt; in structuring your code&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;SOLID principles&lt;/strong&gt; for improving your code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;SOLID is an acronym for five principles that you should use when thinking about
object-oriented code. The principles are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Single-Responsibility Principle (SRP)&lt;/li&gt;
&lt;li&gt;The Open-Closed Principle (OCP)&lt;/li&gt;
&lt;li&gt;The Liskov Substitution Principle (LSP)&lt;/li&gt;
&lt;li&gt;The Interface Segregation Principle (ISP)&lt;/li&gt;
&lt;li&gt;The Dependency Inversion Principle (DIP)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This course is the third in a three-part series. &lt;a href=&quot;https://realpython.com/courses/python-class-object/&quot;&gt;Part one&lt;/a&gt; is an introduction
to class syntax, where you learn how to write a class and use its attributes and
methods. &lt;a href=&quot;https://realpython.com/courses/python-class-inheritance/&quot;&gt;Part two&lt;/a&gt; is about inheritance and class internals.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Operators and Expressions in Python</title>
      <id>https://realpython.com/python-operators-expressions/</id>
      <link href="https://realpython.com/python-operators-expressions/"/>
      <updated>2023-09-18T14:00:00+00:00</updated>
      <summary>In Python, operators are special symbols, combinations of symbols, or keywords that designate some type of computation. You can combine objects and operators to build expressions that perform the actual computation. So, operators are the building blocks of expressions.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In Python, &lt;strong&gt;operators&lt;/strong&gt; are special symbols, combinations of symbols, or keywords that designate some type of computation. You can combine objects and operators to build &lt;strong&gt;expressions&lt;/strong&gt; that perform the actual computation. So, operators are the building blocks of expressions, which you can use to manipulate your data. Therefore, understanding how operators work in Python is essential for you as a programmer.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn about the operators that Python currently supports. You’ll also learn the basics of how to use these operators to build expressions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get to know Python’s &lt;strong&gt;arithmetic operators&lt;/strong&gt; and use them to build &lt;strong&gt;arithmetic expressions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Explore Python’s &lt;strong&gt;comparison&lt;/strong&gt;, &lt;strong&gt;Boolean&lt;/strong&gt;, &lt;strong&gt;identity&lt;/strong&gt;, and &lt;strong&gt;membership&lt;/strong&gt; operators&lt;/li&gt;
&lt;li&gt;Build &lt;strong&gt;expressions&lt;/strong&gt; with comparison, Boolean, identity, and membership operators&lt;/li&gt;
&lt;li&gt;Learn about Python’s &lt;strong&gt;bitwise&lt;/strong&gt; operators and how to use them&lt;/li&gt;
&lt;li&gt;Combine and repeat sequences using the &lt;strong&gt;concatenation&lt;/strong&gt; and &lt;strong&gt;repetition&lt;/strong&gt; operators&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;augmented assignment&lt;/strong&gt; operators and how they work&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a basic understanding of Python programming concepts, such as &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-assignment-operator/&quot;&gt;assignments&lt;/a&gt;, and built-in &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;data types&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-operators-expressions-cheat-sheet/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-operators-expressions-cheat-sheet&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download your comprehensive cheat sheet&lt;/a&gt; covering the various operators in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;&lt;i class=&quot;fa fa-graduation-cap&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt; Take the Quiz:&lt;/strong&gt; Test your knowledge with our interactive “Python Operators and Expressions” quiz. Upon completion you will receive a score so you can track your learning progress over time:&lt;/p&gt;&lt;p class=&quot;text-center my-2&quot;&gt;&lt;a class=&quot;btn btn-primary&quot; href=&quot;/quizzes/python-operators-expressions/&quot; target=&quot;_blank&quot;&gt;Take the Quiz »&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-operators-and-expressions&quot;&gt;Getting Started With Operators and Expressions&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-operators-and-expressions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In programming, an &lt;strong&gt;operator&lt;/strong&gt; is usually a symbol or combination of symbols that allows you to perform a specific operation. This operation can act on one or more &lt;strong&gt;operands&lt;/strong&gt;. If the operation involves a single operand, then the operator is &lt;strong&gt;unary&lt;/strong&gt;. If the operator involves two operands, then the operator is &lt;strong&gt;binary&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For example, in Python, you can use the minus sign (&lt;code&gt;-&lt;/code&gt;) as a unary operator to declare a negative number. You can also use it to subtract two numbers:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;273.15&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-273.15&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this code snippet, the minus sign (&lt;code&gt;-&lt;/code&gt;) in the first example is a unary operator, and the number &lt;code&gt;273.15&lt;/code&gt; is the operand. In the second example, the same symbol is a binary operator, and the numbers &lt;code&gt;5&lt;/code&gt; and &lt;code&gt;2&lt;/code&gt; are its left and right operands.&lt;/p&gt;
&lt;p&gt;Programming languages typically have operators built in as part of their syntax. In many languages, including Python, you can also create your own operator or modify the behavior of existing ones, which is a powerful and advanced feature to have.&lt;/p&gt;
&lt;p&gt;In practice, operators provide a quick shortcut for you to manipulate data, perform mathematical calculations, compare values, run &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean&lt;/a&gt; tests, assign values to variables, and more. In Python, an operator may be a symbol, a combination of symbols, or a &lt;a href=&quot;https://realpython.com/python-keywords/&quot;&gt;keyword&lt;/a&gt;, depending on the type of operator that you’re dealing with.&lt;/p&gt;
&lt;p&gt;For example, you’ve already seen the subtraction operator, which is represented with a single minus sign (&lt;code&gt;-&lt;/code&gt;). The equality operator is a double equal sign (&lt;code&gt;==&lt;/code&gt;). So, it’s a combination of symbols:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, you use the Python equality operator (&lt;code&gt;==&lt;/code&gt;) to compare two numbers. As a result, you get &lt;a href=&quot;https://docs.python.org/3/library/constants.html#True&quot;&gt;&lt;code&gt;True&lt;/code&gt;&lt;/a&gt;, which is one of Python’s Boolean values.&lt;/p&gt;
&lt;p&gt;Speaking of Boolean values, the Boolean or logical operators in Python are keywords rather than signs, as you’ll learn in the section about &lt;a href=&quot;#boolean-operators-and-expressions-in-python&quot;&gt;Boolean operators and expressions&lt;/a&gt;. So, instead of the odd signs like &lt;code&gt;||&lt;/code&gt;, &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;, and &lt;code&gt;!&lt;/code&gt; that many other programming languages use, Python uses &lt;code&gt;or&lt;/code&gt;, &lt;code&gt;and&lt;/code&gt;, and &lt;code&gt;not&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Using keywords instead of odd signs is a really cool design decision that’s consistent with the fact that Python loves and encourages &lt;a href=&quot;https://pep20.org/#readability&quot;&gt;code’s readability&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You’ll find several categories or groups of operators in Python. Here’s a quick list of those categories:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Assignment&lt;/strong&gt; operators&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Arithmetic&lt;/strong&gt; operators&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Comparison&lt;/strong&gt; operators&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Boolean&lt;/strong&gt; or logical operators&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Identity&lt;/strong&gt; operators&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Membership&lt;/strong&gt; operators&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concatenation&lt;/strong&gt; and &lt;strong&gt;repetition&lt;/strong&gt; operators&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bitwise&lt;/strong&gt; operators&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All these types of operators take care of specific types of computations and data-processing tasks. You’ll learn more about these categories throughout this tutorial. However, before jumping into more practical discussions, you need to know that the most elementary goal of an operator is to be part of an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-expression&quot;&gt;expression&lt;/a&gt;. Operators by themselves don’t do much:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;input&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;pm&quot;&gt;^&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;SyntaxError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;incomplete input&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;input&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;pm&quot;&gt;^^&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;SyntaxError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;incomplete input&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;input&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;pm&quot;&gt;^^&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;SyntaxError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;incomplete input&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you can see in this code snippet, if you use an operator without the required operands, then you’ll get a &lt;a href=&quot;https://realpython.com/invalid-syntax-python/&quot;&gt;syntax error&lt;/a&gt;. So, operators must be part of expressions, which you can build using Python objects as operands.&lt;/p&gt;
&lt;p&gt;So, what is an expression anyway? Python has &lt;a href=&quot;https://docs.python.org/3/reference/simple_stmts.html&quot;&gt;simple&lt;/a&gt; and &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html&quot;&gt;compound&lt;/a&gt; statements. A simple statement is a construct that occupies a single &lt;a href=&quot;https://docs.python.org/3/reference/lexical_analysis.html#logical-lines&quot;&gt;logical line&lt;/a&gt;, like an assignment statement. A compound statement is a construct that occupies multiple logical lines, such as a &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt; or a &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional&lt;/a&gt; statement. An &lt;strong&gt;expression&lt;/strong&gt; is a simple statement that produces and returns a value.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-operators-expressions/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-operators-expressions/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #172: Measuring Multiple Facets of Python Performance With Scalene</title>
      <id>https://realpython.com/podcasts/rpp/172/</id>
      <link href="https://realpython.com/podcasts/rpp/172/"/>
      <updated>2023-09-15T12:00:00+00:00</updated>
      <summary>When choosing a tool for profiling Python code performance, should it focus on the CPU, GPU, memory, or individual lines of code? What if it looked at all those factors and didn&#x27;t alter code performance while measuring it? This week on the show, we talk about Scalene with Emery Berger, Professor of Computer Science at the University of Massachusetts Amherst.</summary>
      <content type="html">
        &lt;p&gt;When choosing a tool for profiling Python code performance, should it focus on the CPU, GPU, memory, or individual lines of code? What if it looked at all those factors and didn&#x27;t alter code performance while measuring it? This week on the show, we talk about Scalene with Emery Berger, Professor of Computer Science at the University of Massachusetts Amherst.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Bypassing the GIL for Parallel Processing in Python</title>
      <id>https://realpython.com/python-parallel-processing/</id>
      <link href="https://realpython.com/python-parallel-processing/"/>
      <updated>2023-09-13T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll take a deep dive into parallel processing in Python. You&#x27;ll learn about a few traditional and several novel ways of sidestepping the global interpreter lock (GIL) to achieve genuine shared-memory parallelism of your CPU-bound tasks.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Unlocking Python’s true potential in terms of speed through &lt;a href=&quot;https://en.wikipedia.org/wiki/Parallel_programming_model#Shared_memory&quot;&gt;shared-memory parallelism&lt;/a&gt; has traditionally been limited and challenging to achieve. That’s because the &lt;a href=&quot;https://realpython.com/python-gil/&quot;&gt;global interpreter lock (GIL)&lt;/a&gt; doesn’t allow for thread-based parallel processing in Python. Fortunately, there are several work-arounds for this notorious limitation, which you’re about to explore now!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run &lt;strong&gt;Python threads&lt;/strong&gt; in parallel on multiple CPU cores&lt;/li&gt;
&lt;li&gt;Avoid the &lt;strong&gt;data serialization&lt;/strong&gt; overhead of multiprocessing&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Share memory&lt;/strong&gt; between Python and C runtime environments&lt;/li&gt;
&lt;li&gt;Use different strategies to &lt;strong&gt;bypass the GIL&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Parallelize&lt;/strong&gt; your Python programs to improve their performance&lt;/li&gt;
&lt;li&gt;Build a sample desktop application for &lt;strong&gt;parallel image processing&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this advanced tutorial, you should understand the difference between &lt;a href=&quot;https://realpython.com/python-concurrency/#what-is-concurrency&quot;&gt;concurrency&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-concurrency/#what-is-parallelism&quot;&gt;parallelism&lt;/a&gt;. You’ll benefit from having previous experience with &lt;a href=&quot;https://realpython.com/intro-to-python-threading/&quot;&gt;multithreading&lt;/a&gt; in programming languages other than Python. Finally, it’s best if you’re eager to explore uncharted territory, such as calling &lt;a href=&quot;https://realpython.com/python-bindings-overview/&quot;&gt;foreign Python bindings&lt;/a&gt; or writing bits of &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Don’t worry if your knowledge of parallel processing is a bit rusty, as you’ll have a chance to quickly refresh your memory in the upcoming sections. Also, note that you’ll find all the code samples, image files, and the demo project from this tutorial in the supporting materials, which you can download below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-parallel-processing-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-parallel-processing-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to bypass the GIL and achieve parallel processing in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;recall-the-fundamentals-of-parallel-processing&quot;&gt;Recall the Fundamentals of Parallel Processing&lt;a class=&quot;headerlink&quot; href=&quot;#recall-the-fundamentals-of-parallel-processing&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before dipping your toes into specific ways of bypassing the GIL in Python, you might want to revisit some related topics. Over the following few sections, you’ll familiarize yourself with different computer processing models, task types, abstractions over modern CPUs, and some history. If you already know this information, then feel free to jump ahead to the &lt;a href=&quot;#use-process-based-parallelism-instead-of-multithreading&quot;&gt;classic mechanism&lt;/a&gt; for parallelization in Python.&lt;/p&gt;
&lt;h3 id=&quot;whats-parallel-processing&quot;&gt;What’s Parallel Processing?&lt;a class=&quot;headerlink&quot; href=&quot;#whats-parallel-processing&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Under &lt;a href=&quot;https://en.wikipedia.org/wiki/Flynn%27s_taxonomy&quot;&gt;Flynn’s taxonomy&lt;/a&gt;, the most common types of &lt;strong&gt;parallel processing&lt;/strong&gt; allow you to run the same (&lt;a href=&quot;https://en.wikipedia.org/wiki/Single_instruction,_multiple_data&quot;&gt;SIMD&lt;/a&gt;) or different code fragments (&lt;a href=&quot;https://en.wikipedia.org/wiki/Multiple_instruction,_multiple_data&quot;&gt;MIMD&lt;/a&gt;) in separate execution streams at the same time:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/parallel.bcf05cc11397.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/parallel.bcf05cc11397.png&quot; width=&quot;960&quot; height=&quot;340&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/parallel.bcf05cc11397.png&amp;amp;w=240&amp;amp;sig=ffd8f8d2a20cc7a9acd5778a2deac46826152ca3 240w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/parallel.bcf05cc11397.png&amp;amp;w=320&amp;amp;sig=a1905552ac1dc3ba0e6060dc7265b3310c38df4e 320w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/parallel.bcf05cc11397.png&amp;amp;w=480&amp;amp;sig=099394376d17bdd39e848381b3217fd006a4d639 480w, https://files.realpython.com/media/parallel.bcf05cc11397.png 960w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Parallel Execution of Tasks&quot; data-asset=&quot;5310&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Parallel Execution of Tasks&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Here, two independent tasks or &lt;a href=&quot;https://en.wikipedia.org/wiki/Job_(computing)&quot;&gt;jobs&lt;/a&gt; execute alongside each other. To run more than one piece of code simultaneously like this, you need a computer equipped with a &lt;a href=&quot;https://en.wikipedia.org/wiki/Central_processing_unit&quot;&gt;central processing unit (CPU)&lt;/a&gt; comprising &lt;a href=&quot;https://en.wikipedia.org/wiki/Multi-core_processor&quot;&gt;multiple physical cores&lt;/a&gt;, which is the norm nowadays. While you could alternatively access a &lt;a href=&quot;https://en.wikipedia.org/wiki/Computer_cluster&quot;&gt;cluster&lt;/a&gt; of geographically &lt;a href=&quot;https://en.wikipedia.org/wiki/Distributed_computing&quot;&gt;distributed machines&lt;/a&gt;, you’ll consider only the first option in this tutorial.&lt;/p&gt;
&lt;p&gt;Parallel processing is a particular form of &lt;strong&gt;concurrent processing&lt;/strong&gt;, which is a broader term encompassing &lt;a href=&quot;https://en.wikipedia.org/wiki/Context_switch&quot;&gt;context switching&lt;/a&gt; between multiple tasks. It means that a currently running task might voluntarily suspend its execution or be forcibly suspended to give a slice of the &lt;a href=&quot;https://en.wikipedia.org/wiki/CPU_time&quot;&gt;CPU time&lt;/a&gt; to another task:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/concurrent.f333207efd07.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/concurrent.f333207efd07.png&quot; width=&quot;960&quot; height=&quot;340&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/concurrent.f333207efd07.png&amp;amp;w=240&amp;amp;sig=b2ade107b6cb187401366286311eed0517cfbac5 240w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/concurrent.f333207efd07.png&amp;amp;w=320&amp;amp;sig=e41e9e9fc09eeed965571bb4a8009a466cd6f3c5 320w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/concurrent.f333207efd07.png&amp;amp;w=480&amp;amp;sig=b72754c18b58ed0a3545fa2ec4c102edd46d28fe 480w, https://files.realpython.com/media/concurrent.f333207efd07.png 960w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Concurrent Execution of Tasks&quot; data-asset=&quot;5311&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Concurrent Execution of Tasks&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;In this case, two tasks have been sliced into smaller and intertwined chunks of work that share a single core of the same processing unit. This is analogous to playing chess against &lt;a href=&quot;https://en.wikipedia.org/wiki/Simultaneous_exhibition&quot;&gt;multiple opponents&lt;/a&gt; at the same time, as shown in one of the scenes from the popular TV miniseries &lt;a href=&quot;https://www.imdb.com/title/tt10048342/&quot;&gt;&lt;em&gt;The Queen’s Gambit&lt;/em&gt;&lt;/a&gt;. After each move, the player proceeds to the next opponent in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Round-robin_scheduling&quot;&gt;round-robin&lt;/a&gt; fashion, trying to remember the state of the corresponding game.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Context switching makes &lt;a href=&quot;https://en.wikipedia.org/wiki/Computer_multitasking&quot;&gt;multitasking&lt;/a&gt; possible on single-core architectures. However, multi-core CPUs also benefit from this technique when the tasks outnumber the available processing power, which is often the case. Therefore, concurrent processing usually involves spreading the individual task slices over many CPUs, combining the power of context switching and parallel processing.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;While it takes time for people to switch their focus, computers take turns much quicker. Rapid context switching gives the illusion of parallel execution despite using only one physical CPU. As a result, multiple tasks are making progress together.&lt;/p&gt;
&lt;p&gt;Because of &lt;a href=&quot;https://en.wikipedia.org/wiki/Time-sharing&quot;&gt;time-sharing&lt;/a&gt;, the total time required to finish your intertwined tasks running concurrently is longer when compared to a genuinely parallel version. In fact, context switching has a noticeable overhead that makes the execution time even worse than if you run your tasks one after another using &lt;strong&gt;sequential processing&lt;/strong&gt; on a single CPU. Here’s what sequential processing looks like:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/sequential.f52f718348b0.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/sequential.f52f718348b0.png&quot; width=&quot;960&quot; height=&quot;340&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/sequential.f52f718348b0.png&amp;amp;w=240&amp;amp;sig=03b32ff48639019af2d4244fdc71c09cdf382e61 240w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/sequential.f52f718348b0.png&amp;amp;w=320&amp;amp;sig=b5d4c4a6a64e97108e0f57eabcb4fb81dd46fb63 320w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/sequential.f52f718348b0.png&amp;amp;w=480&amp;amp;sig=4857ffca1bdb8d4d66eca62cccd4bf38d1d411da 480w, https://files.realpython.com/media/sequential.f52f718348b0.png 960w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Sequential Execution of Tasks&quot; data-asset=&quot;5312&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Sequential Execution of Tasks&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;With sequential processing, you don’t start another task until the previous one finishes, so you don’t have the costs of switching back and forth. This situation corresponds to playing an entire chess game with one opponent before moving on to the next one. Meanwhile, the remaining players must sit tight, patiently waiting for their turn.&lt;/p&gt;
&lt;p&gt;On the other hand, playing multiple games concurrently can maximize your &lt;a href=&quot;https://en.wikipedia.org/wiki/Network_throughput&quot;&gt;throughput&lt;/a&gt;. When you prioritize games with players who make quick decisions over those who need more time to think, then you’ll finish more games sooner. Therefore, intertwining can improve the &lt;a href=&quot;https://en.wikipedia.org/wiki/Latency_(engineering)&quot;&gt;latency&lt;/a&gt;, or &lt;strong&gt;response times&lt;/strong&gt;, of the individual tasks, even when you only have one stream of execution.&lt;/p&gt;
&lt;p&gt;As you can probably tell, choosing between &lt;strong&gt;parallel&lt;/strong&gt;, &lt;strong&gt;concurrent&lt;/strong&gt;, and &lt;strong&gt;sequential&lt;/strong&gt; processing models can feel like plotting out your next three moves in chess. You have to consider several factors, so there’s no one-size-fits-all solution.&lt;/p&gt;
&lt;p&gt;Whether context switching actually helps will depend on how you prioritize your tasks. Inefficient task scheduling can lead to &lt;a href=&quot;https://en.wikipedia.org/wiki/Starvation_(computer_science)&quot;&gt;starving&lt;/a&gt; shorter tasks of CPU time.&lt;/p&gt;
&lt;p&gt;Additionally, the types of tasks are critical. Two broad categories of concurrent tasks are &lt;strong&gt;CPU-bound&lt;/strong&gt; and &lt;strong&gt;I/O-bound&lt;/strong&gt; ones. The CPU-bound tasks will only benefit from truly parallel execution to run faster, whereas I/O-bound tasks can leverage concurrent processing to reduce latency. You’ll learn more about these categories’ characteristics now.&lt;/p&gt;
&lt;h3 id=&quot;how-do-cpu-bound-and-io-bound-tasks-differ&quot;&gt;How Do CPU-Bound and I/O-Bound Tasks Differ?&lt;a class=&quot;headerlink&quot; href=&quot;#how-do-cpu-bound-and-io-bound-tasks-differ&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-parallel-processing/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-parallel-processing/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Inheritance and Internals: Object-Oriented Programming in Python</title>
      <id>https://realpython.com/courses/python-class-inheritance/</id>
      <link href="https://realpython.com/courses/python-class-inheritance/"/>
      <updated>2023-09-12T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about the various types of inheritance that you can use to write object-oriented code in Python. These include class inheritance, multilevel inheritance, and multiple inheritance, along with special methods and abstract base classes.</summary>
      <content type="html">
        &lt;p&gt;Python includes mechanisms for writing object-oriented code where the
data and operations on that data are structured together. The &lt;strong&gt;&lt;code&gt;class&lt;/code&gt; keyword&lt;/strong&gt;
is how you create these structures in Python. The definition of a class can be
based on other classes, allowing the creation of hierarchical structures and
promoting code reuse. This mechanism is known as inheritance.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Basic &lt;strong&gt;class inheritance&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multi-level inheritance&lt;/strong&gt;, or classes that inherit from classes&lt;/li&gt;
&lt;li&gt;Classes that inherit directly from more than one class, or &lt;strong&gt;multiple inheritance&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Special methods&lt;/strong&gt; that you can use when writing classes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Abstract base classes&lt;/strong&gt; for classes that you don&amp;rsquo;t want to fully implement yet&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This course is the second in a three-part series. &lt;a href=&quot;https://realpython.com/courses/python-class-object/&quot;&gt;Part one&lt;/a&gt; is an introduction
to class syntax, teaching you how to write a class and use its attributes and
methods. Part three dives deeper into the philosophy behind writing good
object-oriented code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Object-Oriented Programming (OOP) in Python 3</title>
      <id>https://realpython.com/python3-object-oriented-programming/</id>
      <link href="https://realpython.com/python3-object-oriented-programming/"/>
      <updated>2023-09-11T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn all about object-oriented programming (OOP) in Python. You&#x27;ll learn the basics of the OOP paradigm and cover concepts like classes and inheritance. You&#x27;ll also see how to instantiate an object from a class.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Object-oriented programming (OOP)&lt;/strong&gt; is a method of structuring a program by bundling related properties and behaviors into individual &lt;strong&gt;objects&lt;/strong&gt;. In this tutorial, you’ll learn the basics of object-oriented programming in Python.&lt;/p&gt;
&lt;p&gt;Conceptually, objects are like the components of a system. Think of a program as a factory assembly line of sorts. At each step of the assembly line, a system component processes some material, ultimately transforming raw material into a finished product.&lt;/p&gt;
&lt;p&gt;An object contains data, like the raw or preprocessed materials at each step on an assembly line. In addition, the object contains behavior, like the action that each assembly line component performs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Define a &lt;strong&gt;class&lt;/strong&gt;, which is like a blueprint for creating an object&lt;/li&gt;
&lt;li&gt;Use classes to &lt;strong&gt;create new objects&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Model systems with &lt;strong&gt;class inheritance&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This tutorial is adapted from the chapter “Object-Oriented Programming (OOP)” in &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The book uses Python’s built-in &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; editor to create and edit Python files and interact with the Python shell, so you’ll see occasional references to IDLE throughout this tutorial. If you don’t use IDLE, you can &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run the example code&lt;/a&gt; from the editor and environment of your choice.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/object-oriented-programming-oop-in-python-3-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-object-oriented-programming-oop-in-python-3-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to do object-oriented programming with classes in Python 3.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;what-is-object-oriented-programming-in-python&quot;&gt;What Is Object-Oriented Programming in Python?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-object-oriented-programming-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Object-oriented programming is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Programming_paradigm&quot;&gt;programming paradigm&lt;/a&gt; that provides a means of structuring programs so that properties and behaviors are bundled into individual &lt;strong&gt;objects&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For example, an object could represent a person with &lt;strong&gt;properties&lt;/strong&gt; like a name, age, and address and &lt;strong&gt;behaviors&lt;/strong&gt; such as walking, talking, breathing, and running. Or it could represent an &lt;a href=&quot;https://realpython.com/python-send-email/&quot;&gt;email&lt;/a&gt; with properties like a recipient list, subject, and body and behaviors like adding attachments and sending. &lt;/p&gt;
&lt;p&gt;Put another way, object-oriented programming is an approach for modeling concrete, real-world things, like cars, as well as relations between things, like companies and employees or students and teachers. OOP models real-world entities as software objects that have some data associated with them and can perform certain operations.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also check out the &lt;a href=&quot;https://realpython.com/courses/python-basics-oop/&quot;&gt;Python Basics: Object-Oriented Programming&lt;/a&gt; video course to reinforce the skills that you’ll develop in this section of the tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The key takeaway is that objects are at the center of object-oriented programming in Python. In other programming paradigms, objects only represent the data. In OOP, they additionally inform the overall structure of the program.&lt;/p&gt;
&lt;h2 id=&quot;how-do-you-define-a-class-in-python&quot;&gt;How Do You Define a Class in Python?&lt;a class=&quot;headerlink&quot; href=&quot;#how-do-you-define-a-class-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Python, you define a class by using the &lt;code&gt;class&lt;/code&gt; keyword followed by a name and a colon. Then you use &lt;code&gt;.__init__()&lt;/code&gt; to declare which attributes each instance of the class should have:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fm&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;age&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;age&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But what does all of that mean? And why do you even need classes in the first place? Take a step back and consider using built-in, primitive &lt;a href=&quot;https://realpython.com/courses/python-data-types/&quot;&gt;data structures&lt;/a&gt; as an alternative.&lt;/p&gt;
&lt;p&gt;Primitive data structures—like &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt;—are designed to represent straightforward pieces of information, such as the cost of an apple, the name of a poem, or your favorite colors, respectively. What if you want to represent something more complex?&lt;/p&gt;
&lt;p&gt;For example, you might want to track employees in an organization. You need to store some basic information about each employee, such as their name, age, position, and the year they started working.&lt;/p&gt;
&lt;p&gt;One way to do this is to represent each employee as a &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;list&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;kirk&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;James Kirk&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Captain&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2265&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;spock&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Spock&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;35&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Science Officer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2254&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mccoy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Leonard McCoy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Chief Medical Officer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2266&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There are a number of issues with this approach.&lt;/p&gt;
&lt;p&gt;First, it can make larger code files more difficult to manage. If you reference &lt;code&gt;kirk[0]&lt;/code&gt; several lines away from where you declared the &lt;code&gt;kirk&lt;/code&gt; list, will you remember that the element with &lt;a href=&quot;https://realpython.com/python-strings/#string-indexing&quot;&gt;index&lt;/a&gt; &lt;code&gt;0&lt;/code&gt; is the employee’s name? &lt;/p&gt;
&lt;p&gt;Second, it can introduce errors if employees don’t have the same number of elements in their respective lists. In the &lt;code&gt;mccoy&lt;/code&gt; list above, the age is missing, so &lt;code&gt;mccoy[1]&lt;/code&gt; will return &lt;code&gt;&quot;Chief Medical Officer&quot;&lt;/code&gt; instead of &lt;a href=&quot;https://en.wikipedia.org/wiki/Leonard_McCoy&quot;&gt;Dr. McCoy’s&lt;/a&gt; age.&lt;/p&gt;
&lt;p&gt;A great way to make this type of code more manageable and more maintainable is to use &lt;strong&gt;classes&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python3-object-oriented-programming/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #171: Making Each Line of Code Efficient &amp; Python In Excel</title>
      <id>https://realpython.com/podcasts/rpp/171/</id>
      <link href="https://realpython.com/podcasts/rpp/171/"/>
      <updated>2023-09-08T12:00:00+00:00</updated>
      <summary>Are you writing efficient Python with as few lines of code as possible? Are you familiar with the many built-in language features that will simplify your code and make it more Pythonic? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Are you writing efficient Python with as few lines of code as possible? Are you familiar with the many built-in language features that will simplify your code and make it more Pythonic? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Generate Beautiful QR Codes With Python</title>
      <id>https://realpython.com/python-generate-qr-code/</id>
      <link href="https://realpython.com/python-generate-qr-code/"/>
      <updated>2023-09-06T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use Python to generate QR codes, from your standard black-and-white QR codes to beautiful ones with your favorite colors. You&#x27;ll learn how to format QR codes, rotate them, and even replace the static background with moving images.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;From restaurant e-menus to airline boarding passes, &lt;strong&gt;QR codes&lt;/strong&gt; have numerous applications that impact your day-to-day life and enrich the user’s experience. Wouldn’t it be great to make them look good, too? With the help of this tutorial, you’ll learn how to use Python to generate beautiful QR codes for your personal use case. &lt;/p&gt;
&lt;p&gt;In its most basic format, a QR code contains black squares and dots on a white background, with information that any smartphone or device with a dedicated QR scanner can decode. Unlike a traditional bar code, which holds informationation horizontally, a QR code holds the data in two dimensions, and it can hold over a hundred times more information.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Generate&lt;/strong&gt; a basic black-and-white QR code&lt;/li&gt;
&lt;li&gt;Change the &lt;strong&gt;size&lt;/strong&gt; and &lt;strong&gt;margins&lt;/strong&gt; of the QR code&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;colorful&lt;/strong&gt; QR codes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rotate&lt;/strong&gt; the QR code&lt;/li&gt;
&lt;li&gt;Replace the static background with an &lt;strong&gt;animated GIF&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Traditionally, QR codes have been predominantly black-and-white. Now, thanks to creative innovations, QR codes come in all sorts of shapes, sizes, and colors. If you’d like to learn how to create not only two-tone QR codes but also colorful and artistic ones, then this is the tutorial for you.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-generate-qr-code-bonus/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-generate-qr-code-bonus&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that shows you how to generate a beautiful code with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;using-python-to-generate-a-basic-qr-code&quot;&gt;Using Python to Generate a Basic QR Code&lt;a class=&quot;headerlink&quot; href=&quot;#using-python-to-generate-a-basic-qr-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To begin with, you’re going to create a black-and-white QR code that encodes some content. To follow along with this tutorial, you’ll need to install &lt;a href=&quot;https://segno.readthedocs.io/en/latest/&quot;&gt;Segno&lt;/a&gt;, which is a popular Python library for generating QR codes. To install Segno, you can run &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; from your &lt;a href=&quot;https://realpython.com/python-command-line-arguments/#the-command-line-interface&quot;&gt;command line&lt;/a&gt;: &lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;segno
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once you’ve installed &lt;code&gt;segno&lt;/code&gt;, create a Python file named &lt;code&gt;basic_qrcode.py&lt;/code&gt;. To create a black-and-white QR code object that encodes some content, you’ll have to use the &lt;code&gt;make_qr()&lt;/code&gt; function. This ensures that you’re creating a full-size QR code, and the only mandatory argument you’ll need to pass is the information that you want to encode. &lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use the &lt;a href=&quot;https://segno.readthedocs.io/en/stable/api.html#segno.make&quot;&gt;&lt;code&gt;make()&lt;/code&gt;&lt;/a&gt; function to create a QR code object, but depending on the content you’re encoding, it might create a micro QR code. For the sake of this tutorial, you can think of that as a smaller QR code. To enforce the creation of a full-size QR code, you should use the &lt;code&gt;make_qr()&lt;/code&gt; function.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;QR codes are capable of handling all types of data, such as alphanumeric characters, symbols, and even URLs. To begin your journey of generating QR codes in Python, you’ll start by creating a QR code object that will encode the text &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# basic_qrcode.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;segno&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;segno&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;make_qr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, World&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;At this stage, you’ve written the code to encode the text &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt; by passing this to the &lt;code&gt;make_qr()&lt;/code&gt; function. This will greet your user with that text, and it might also offer the option of searching for &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt; on the Internet.&lt;/p&gt;
&lt;p&gt;Now, to generate a black-and-white QR code that you can actually view and scan, you’ll need to store the encoded content as a variable and use the &lt;a href=&quot;https://segno.readthedocs.io/en/stable/api.html#segno.QRCode.save&quot;&gt;&lt;code&gt;.save()&lt;/code&gt;&lt;/a&gt; method to save your QR code as an image. Here’s an example of how you can create a &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variable&lt;/a&gt; called &lt;code&gt;qrcode&lt;/code&gt; that encodes the text &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt; as a black-and-white QR code object, which you then save as a PNG file called &lt;code&gt;basic_qrcode.png&lt;/code&gt;: &lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# basic_qrcode.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;segno&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;qrcode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;segno&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;make_qr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, World&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;n&quot;&gt;qrcode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;basic_qrcode.png&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;.save()&lt;/code&gt; method serializes the QR code into a file format of your choice, as long as the chosen format is supported. When you apply &lt;code&gt;.save()&lt;/code&gt; to the variable that you’ve created with the encoded content, you need to specify the filename including an optional file path. In the example above, you’re saving the QR code image as a file named &lt;code&gt;basic_qrcode.png&lt;/code&gt; in the same directory where you’ll be executing your code, so you don’t specify a file path. &lt;/p&gt;
&lt;p&gt;If you’d like to save the image in a different directory, then you can specify the desired &lt;a href=&quot;https://realpython.com/python-pathlib/&quot;&gt;file path&lt;/a&gt; together with the filename as an argument in the &lt;code&gt;.save()&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;Once you’ve finished writing the steps for generating a black-and-white QR code in &lt;code&gt;basic_qrcode.py&lt;/code&gt;, you’ll need to &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run the Python script&lt;/a&gt; from your command line:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;basic_qrcode.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Congratulations, you’ve just created a black-and-white QR code that encodes the text &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt; using &lt;code&gt;make_qr()&lt;/code&gt; and &lt;code&gt;.save()&lt;/code&gt;. You can now scan your QR code image, which you’ll find in the same directory that you’re running your code from. Or, you can scan the QR code image below:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png&quot; width=&quot;29&quot; height=&quot;29&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png&amp;amp;w=7&amp;amp;sig=103566dafee2d7f37ef8a26307e21a5fd7cdd840 7w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png&amp;amp;w=9&amp;amp;sig=79cd20a548f17a00a25bcc52abcbeca16bada377 9w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png&amp;amp;w=14&amp;amp;sig=508bd9e1858b7b4f28d4235399c18286a4433bfe 14w, https://files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png 29w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;An image of a basic black and white QR Code&quot; data-asset=&quot;5206&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;You may have found that the QR code image is a little difficult to view or read because of its size, so the next item that you’re going to adjust is the size of your basic QR code.&lt;/p&gt;
&lt;h2 id=&quot;changing-the-size-the-qr-code&quot;&gt;Changing the Size the QR Code&lt;a class=&quot;headerlink&quot; href=&quot;#changing-the-size-the-qr-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When trying to scan your QR code image or the QR code in the tutorial, you might have found it difficult to read because of its size.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-generate-qr-code/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-generate-qr-code/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Class Concepts: Object-Oriented Programming in Python</title>
      <id>https://realpython.com/courses/python-class-object/</id>
      <link href="https://realpython.com/courses/python-class-object/"/>
      <updated>2023-09-05T12:00:00+00:00</updated>
      <summary>Python uses object-oriented programming to group data and associated operations together into classes. In this video course, you&#x27;ll learn how to write object-oriented code with classes, attributes, and methods.</summary>
      <content type="html">
        &lt;p&gt;Python includes mechanisms for doing &lt;strong&gt;object-oriented programming&lt;/strong&gt;, where the
data and operations on that data are structured together. The &lt;code&gt;class&lt;/code&gt; keyword
is how you create these structures in Python. &lt;strong&gt;Attributes&lt;/strong&gt; are the data
values, and &lt;strong&gt;methods&lt;/strong&gt; are the function-like operations that you can perform 
on classes. In this course, you&amp;rsquo;ll explore writing code using &lt;code&gt;class&lt;/code&gt; and its 
associated attributes and methods.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why you write &lt;strong&gt;object-oriented code&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to write a &lt;strong&gt;class&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;attributes&lt;/strong&gt; and &lt;strong&gt;methods&lt;/strong&gt; are&lt;/li&gt;
&lt;li&gt;How to use the &lt;strong&gt;descriptor protocol&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This course is the first in a three-part series. Part two covers how to
write reusable hierarchies of classes using inheritance, while part three
dives deeper into the philosophy behind writing good object-oriented code.&lt;/p&gt;
&lt;div class=&quot;container border rounded my-4&quot;&gt;
  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;i class=&quot;fa fa-cloud-download mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
&lt;strong&gt;Download&lt;/strong&gt;&lt;/p&gt;
      &lt;a class=&quot;stretched-link&quot; href=&quot;/courses/python-class-object/downloads/python-class-object-code/&quot; target=&quot;_blank&quot;&gt;&lt;p class=&quot;h2 my-0 h3&quot;&gt;Sample Code (.zip)&lt;/p&gt;&lt;/a&gt;
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;5.2 KB&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;container border rounded my-4&quot;&gt;
  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;i class=&quot;fa fa-cloud-download mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
&lt;strong&gt;Download&lt;/strong&gt;&lt;/p&gt;
      &lt;a class=&quot;stretched-link&quot; href=&quot;/courses/python-class-object/downloads/python-class-object-slides/&quot; target=&quot;_blank&quot;&gt;&lt;p class=&quot;h2 my-0 h3&quot;&gt;Course Slides (.pdf)&lt;/p&gt;&lt;/a&gt;
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;1013.9 KB&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python News: What&#x27;s New From August 2023</title>
      <id>https://realpython.com/python-news-august-2023/</id>
      <link href="https://realpython.com/python-news-august-2023/"/>
      <updated>2023-09-04T14:00:00+00:00</updated>
      <summary>In August 2023, Python 3.12.0rc1 was released. Microsoft announced Python in Excel. The Python Software Foundation published its Annual Impact Report for 2023, and the Python ecosystem released new versions of several important projects, such as Django, Pydantic, and Flask.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In August 2023, Python &lt;strong&gt;3.12.0rc1&lt;/strong&gt; came out! With several exciting features, improvements, and optimizations, this release is only two steps away from the final release scheduled for October. If you want to stay on the cutting edge, then you must give it a try. But note that you shouldn’t use it in production.&lt;/p&gt;
&lt;p&gt;Another exciting release was &lt;strong&gt;Python in Excel&lt;/strong&gt;, which allows you to leverage the power of Python inside your Excel workbooks. You’ll be able to use Python’s data science ecosystem while you remain in your Excel comfort zone with known formulas, charts, and more.&lt;/p&gt;
&lt;p&gt;But that’s not all! The &lt;strong&gt;Python Software Foundation (PSF)&lt;/strong&gt; announced a new roster of fellows and a safety and security engineer for PyPI. Some key package maintainers were busy with the &lt;strong&gt;Python DataFrame Summit 2023&lt;/strong&gt;, and several key libraries released new versions.&lt;/p&gt;
&lt;p&gt;Let’s dive into the most exciting &lt;strong&gt;Python news&lt;/strong&gt; from August 2023!&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Join Now:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-newsletter&quot; data-focus=&quot;false&quot;&gt;Click here to join the Real Python Newsletter&lt;/a&gt; and you&#x27;ll never miss another Python tutorial, course update, or post.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;python-3120-release-candidate-arrives&quot;&gt;Python 3.12.0 Release Candidate Arrives&lt;a class=&quot;headerlink&quot; href=&quot;#python-3120-release-candidate-arrives&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This August, Python put out its first &lt;strong&gt;release candidate&lt;/strong&gt; version, 3.12.0rc1. This version is only two steps away from the final release, 3.12.0, which is scheduled for October 2. Before that, Python will deliver another release candidate, planned for September 4.&lt;/p&gt;
&lt;p&gt;As Python ventures into the release candidate stage, only confirmed bug fixes will be accepted into the codebase. The goal is to have as few code changes as possible. Most likely, the core team will focus on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Polishing and documenting all the changes&lt;/li&gt;
&lt;li&gt;Updating the &lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html&quot;&gt;What’s New&lt;/a&gt; document&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you can read in the release notes, 3.12 will have the following list of new features compared to Python 3.11:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#pep-701-syntactic-formalization-of-f-strings&quot;&gt;More flexible f-string parsing&lt;/a&gt;, allowing you to do more with your f-strings than you previously could (&lt;a href=&quot;https://peps.python.org/pep-0701/&quot;&gt;PEP 701&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#pep-688-making-the-buffer-protocol-accessible-in-python&quot;&gt;Support for the buffer protocol&lt;/a&gt; in Python code (&lt;a href=&quot;https://peps.python.org/pep-0688/&quot;&gt;PEP 688&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;A new debugging/profiling API (&lt;a href=&quot;https://peps.python.org/pep-0669/&quot;&gt;PEP 669&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#pep-684-a-per-interpreter-gil&quot;&gt;Support for isolated subinterpreters&lt;/a&gt; with separate global interpreter locks (&lt;a href=&quot;https://peps.python.org/pep-0684&quot;&gt;PEP 684&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#improved-error-messages&quot;&gt;Even more improved error messages&lt;/a&gt;, meaning that you get suggestions for more exceptions potentially caused by typos&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/howto/perf_profiling.html&quot;&gt;Support for the Linux &lt;code&gt;perf&lt;/code&gt; profiler&lt;/a&gt; to report Python function names in traces &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#optimizations&quot;&gt;Many large and small performance improvements&lt;/a&gt;, such as &lt;a href=&quot;https://peps.python.org/pep-0709/&quot;&gt;PEP 709&lt;/a&gt;, which deliver an estimated 5 percent overall performance improvement&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’d like to learn more about some of these improvements, then check out Real Python’s previews of &lt;a href=&quot;https://realpython.com/python312-f-strings/&quot;&gt;more intuitive and consistent f-strings&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python312-error-messages/&quot;&gt;ever better error messages&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python312-perf-profiler/&quot;&gt;support for the Linux &lt;code&gt;perf&lt;/code&gt; profiler&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As usual, this version also brings several deprecations that you may need to consider. For a detailed list of changes, additions, and removals, you can check the &lt;a href=&quot;https://docs.python.org/3.12/whatsnew/changelog.html#python-3-12-0-release-candidate-1&quot;&gt;changelog&lt;/a&gt; document.&lt;/p&gt;
&lt;p&gt;Just like other &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;pre-release&lt;/a&gt; versions, Python 3.12.0rc1 is intended for experimentation and testing purposes only and isn’t recommended for use in production.&lt;/p&gt;
&lt;h2 id=&quot;python-makes-its-way-into-microsoft-excel&quot;&gt;Python Makes Its Way Into Microsoft Excel&lt;a class=&quot;headerlink&quot; href=&quot;#python-makes-its-way-into-microsoft-excel&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On August 22, Microsoft announced &lt;a href=&quot;https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439&quot;&gt;Python in Excel&lt;/a&gt;, a new and exciting feature that combines the flexibility of Excel and the power of Python. This combination may have a considerable impact on the &lt;a href=&quot;https://realpython.com/tutorials/data-science/&quot;&gt;data science&lt;/a&gt; industry.&lt;/p&gt;
&lt;p&gt;This is a huge announcement, and even &lt;a href=&quot;https://twitter.com/gvanrossum&quot;&gt;Guido van Rossum&lt;/a&gt; himself has been helping with the integration of both tools:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png&quot; width=&quot;1186&quot; height=&quot;1066&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png&amp;amp;w=296&amp;amp;sig=7bb19e05d0a66b43d0edd026e14e5f181d2f1c37 296w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png&amp;amp;w=395&amp;amp;sig=8cb9d1ae09d3065ec77f10c92ed46e296bda3b1c 395w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png&amp;amp;w=593&amp;amp;sig=3e3fc9df48b98e69c1d29268fdce1e7ba002f3b2 593w, https://files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png 1186w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Guido Twitter&#x27;s Post About Python in Excel&quot; data-asset=&quot;5332&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;&lt;a href=&quot;https://twitter.com/gvanrossum/status/1694031794306458056&quot; target=&quot;_blank&quot;&gt;Image source&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=H4XbvL8Mglc&quot;&gt;Python in Excel&lt;/a&gt; allows you to natively use Python inside an Excel workbook without any additional setup requirements. You only need the new &lt;code&gt;PY&lt;/code&gt; function, which lets you input Python code directly into Excel cells:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-august-2023/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-august-2023/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #170: Finding the Right Coding Font for Programming in Python</title>
      <id>https://realpython.com/podcasts/rpp/170/</id>
      <link href="https://realpython.com/podcasts/rpp/170/"/>
      <updated>2023-09-01T12:00:00+00:00</updated>
      <summary>What should you consider when picking a font for coding in Python? What characters and their respective glyphs should you check before making your decision? This week on the show, we talk with Real Python author and core team member Philipp Acsany about his recent article, Choosing the Best Coding Font for Programming.</summary>
      <content type="html">
        &lt;p&gt;What should you consider when picking a font for coding in Python? What characters and their respective glyphs should you check before making your decision? This week on the show, we talk with Real Python author and core team member Philipp Acsany about his recent article, Choosing the Best Coding Font for Programming.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Get Started With Django: Build a Portfolio App</title>
      <id>https://realpython.com/get-started-with-django-1/</id>
      <link href="https://realpython.com/get-started-with-django-1/"/>
      <updated>2023-08-30T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn the basics of creating powerful web applications with Django, a Python web framework. You&#x27;ll build an example portfolio application to showcase your web development projects.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Django is a fully featured Python web framework that you can use to build complex web applications. In this tutorial, you’ll jump in and learn &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django&lt;/a&gt; by completing an example project. You’ll follow the steps to create a fully functioning web application and, along the way, learn what some of the most important features of the framework are and how they work together.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn about the &lt;strong&gt;advantages&lt;/strong&gt; of using &lt;strong&gt;Django&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Investigate the &lt;strong&gt;architecture&lt;/strong&gt; of a Django site&lt;/li&gt;
&lt;li&gt;Set up a new Django project with &lt;strong&gt;multiple apps&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Build &lt;strong&gt;models and views&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create and connect &lt;strong&gt;Django templates&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Upload images&lt;/strong&gt; into your Django site&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At the end of this tutorial, you’ll have a working portfolio website to showcase your projects. If you’re curious about how the final &lt;strong&gt;source code&lt;/strong&gt; looks, then you can click the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/get-started-with-django-1-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-get-started-with-django-1-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the Python source code&lt;/a&gt; for your Django portfolio project.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;learn-django&quot;&gt;Learn Django&lt;a class=&quot;headerlink&quot; href=&quot;#learn-django&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are endless web development frameworks out there, so why should you learn Django over any of the others? First of all, it’s written in Python, one of the most readable and beginner-friendly programming languages out there.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This tutorial assumes an intermediate knowledge of the Python language. If you’re new to programming with Python, then check out the &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics learning path&lt;/a&gt; or the &lt;a href=&quot;https://realpython.com/products/real-python-course/&quot;&gt;introductory course&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The second reason you should learn Django is the scope of its features. When building a website, you don’t need to rely on any external libraries or packages if you choose Django. This means that you don’t need to learn how to use anything else, and the syntax is seamless because you’re using only one framework.&lt;/p&gt;
&lt;p&gt;There’s also the added benefit that Django is straightforward to update, since the core functionality is in one package. If you do find yourself needing to add extra features, there are several external libraries that you can use to enhance your site.&lt;/p&gt;
&lt;p&gt;One of the great things about the Django framework is its &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;in-depth documentation&lt;/a&gt;. It has detailed documentation on every aspect of Django and also has great examples and even a tutorial to get you started.&lt;/p&gt;
&lt;p&gt;There’s also a fantastic community of Django developers, so if you get stuck, there’s almost always a way forward by either checking the docs or &lt;a href=&quot;https://realpython.com/community/&quot;&gt;asking the community&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Django is a high-level web application framework with loads of features. It’s great for anyone new to web development due to its fantastic documentation, and it’s especially great if you’re also familiar with Python.&lt;/p&gt;
&lt;h2 id=&quot;understand-the-structure-of-a-django-website&quot;&gt;Understand the Structure of a Django Website&lt;a class=&quot;headerlink&quot; href=&quot;#understand-the-structure-of-a-django-website&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A Django website consists of a single &lt;strong&gt;project&lt;/strong&gt; that’s split into separate &lt;strong&gt;apps&lt;/strong&gt;. The idea is that each app handles a self-contained task that the site needs to perform. As an example, imagine an application like Instagram. There are several different tasks that it needs to perform:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;User management&lt;/strong&gt;: Logging in and out, registering, and so on&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The image feed&lt;/strong&gt;: Uploading, editing, and displaying images&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Private messaging&lt;/strong&gt;: Sending messages between users and providing notifications&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are each separate pieces of functionality, so if this example were a Django site, then each piece of functionality would be a different Django app inside a single Django project.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; A Django project contains at least one app. But even when there are more apps in the Django project, you commonly refer to a Django project as a &lt;strong&gt;web app&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The Django project holds some configurations that apply to the project as a whole, such as project settings, URLs, shared templates and static files. Each application can have its own database, and it’ll have its own functions to control how it displays data to the user in HTML templates.&lt;/p&gt;
&lt;p&gt;Each application also has its own URLs as well as its own HTML templates and static files, such as &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/html-css-python/#style-your-content-with-css&quot;&gt;CSS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Django apps are structured so that there’s a separation of logic. It supports the &lt;a href=&quot;https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller&quot;&gt;model-view-controller pattern&lt;/a&gt;, which is the architecture for most web frameworks. The basic principle is that each application includes three separate files that handle the three main pieces of logic separately:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Model&lt;/strong&gt; defines the data structure. This is usually the database description and often the base layer to an application.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;View&lt;/strong&gt; displays some or all of the data to the user with &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML and CSS&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Controller&lt;/strong&gt; handles how the database and the view interact.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you want to learn more about the MVC pattern, then check out &lt;a href=&quot;https://realpython.com/the-model-view-controller-mvc-paradigm-summarized-with-legos/&quot;&gt;Model-View-Controller (MVC) Explained – With Legos&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In Django, the architecture is slightly different. Although it’s based on the MVC pattern, Django handles the controller part itself. There’s no need to define how the database and views interact. It’s all done for you!&lt;/p&gt;
&lt;p&gt;The pattern Django utilizes is called the &lt;strong&gt;model-view-template (MVT)&lt;/strong&gt; pattern. All you need to do is add some URL configurations that the views map to, and Django handles the rest!&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/get-started-with-django-1/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/get-started-with-django-1/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Create a Python Wordle Clone With Rich</title>
      <id>https://realpython.com/courses/python-wordle-clone/</id>
      <link href="https://realpython.com/courses/python-wordle-clone/"/>
      <updated>2023-08-29T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build your own Wordle clone with Python. Your game will run in the terminal, and you&#x27;ll use Rich to ensure your word-guessing app looks good. Learn how to build a command-line application from scratch and then challenge your friends to a wordly competition!</summary>
      <content type="html">
        &lt;p&gt;In this video course, you&amp;rsquo;ll build your own &lt;strong&gt;Wordle clone&lt;/strong&gt; for the terminal. Since Josh Wardle launched &lt;a href=&quot;https://en.wikipedia.org/wiki/Wordle&quot;&gt;Wordle&lt;/a&gt; in October 2021, millions of people have played it. While you can play the original game on the Web, you&amp;rsquo;ll create your version as a command-line application and then use the &lt;strong&gt;Rich library&lt;/strong&gt; to make it look good.&lt;/p&gt;
&lt;p&gt;As you follow along in this step-by-step project, you&amp;rsquo;ll practice how to set up a simple prototype game before iteratively developing it into a solid application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Build out a command-line application from a &lt;strong&gt;prototype&lt;/strong&gt; to a &lt;strong&gt;polished game&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Read and &lt;strong&gt;validate user input&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use Rich&amp;rsquo;s console to create an &lt;strong&gt;attractive user interface&lt;/strong&gt; in the terminal&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Organize your code&lt;/strong&gt; into functions&lt;/li&gt;
&lt;li&gt;Provide your users with &lt;strong&gt;actionable feedback&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll create &lt;strong&gt;Wyrdl&lt;/strong&gt;, your own Wordle clone in Python. This project is for anyone getting comfortable with Python who wants to build a terminal application from the ground up. Throughout the course, you&amp;rsquo;ll build your code step-by-step while focusing on having a game that you can play from the start.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Iterate Through a Dictionary in Python</title>
      <id>https://realpython.com/iterate-through-dictionary-python/</id>
      <link href="https://realpython.com/iterate-through-dictionary-python/"/>
      <updated>2023-08-28T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll take a deep dive into how to iterate through a dictionary in Python. Dictionaries are a fundamental data type in Python, and you can solve various programming problems by iterating through them.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Dictionaries&lt;/strong&gt; are one of the most important and useful built-in &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structures&lt;/a&gt; in Python. They’re everywhere and are a fundamental part of the language itself. In your code, you’ll use dictionaries to solve many programming problems that may require iterating through the dictionary at hand. In this tutorial, you’ll dive deep into how to iterate through a dictionary in Python.&lt;/p&gt;
&lt;p&gt;Solid knowledge of dictionary iteration will help you write better, more robust code. In your journey through dictionary iteration, you’ll write several examples that will help you grasp the different ways to traverse a dictionary by iterating over its keys, values, and items.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get to know some of the &lt;strong&gt;main features&lt;/strong&gt; of dictionaries&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterate through&lt;/strong&gt; a dictionary in Python by using different &lt;strong&gt;techniques&lt;/strong&gt; and tools&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Transform&lt;/strong&gt; your dictionaries while iterating through them in Python&lt;/li&gt;
&lt;li&gt;Explore other &lt;strong&gt;tools&lt;/strong&gt; and &lt;strong&gt;techniques&lt;/strong&gt; that facilitate dictionary iteration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a basic understanding of Python &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;, know how to use Python &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; loops, and be familiar with &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;comprehensions&lt;/a&gt;. Knowing other tools like the built-in &lt;a href=&quot;https://realpython.com/python-map-function/&quot;&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-filter-function/&quot;&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/a&gt; functions and the &lt;a href=&quot;https://realpython.com/python-itertools/&quot;&gt;&lt;code&gt;itertools&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-collections-module/&quot;&gt;&lt;code&gt;collections&lt;/code&gt;&lt;/a&gt; modules is also a plus.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/iterate-through-dictionary-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-iterate-through-dictionary-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that shows you how to iterate through a dictionary with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;&lt;i class=&quot;fa fa-graduation-cap&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt; Take the Quiz:&lt;/strong&gt; Test your knowledge with our interactive “Python Dictionary Iteration” quiz. Upon completion you will receive a score so you can track your learning progress over time:&lt;/p&gt;&lt;p class=&quot;text-center my-2&quot;&gt;&lt;a class=&quot;btn btn-primary&quot; href=&quot;/quizzes/python-dictionary-iteration/&quot; target=&quot;_blank&quot;&gt;Take the Quiz »&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-python-dictionaries&quot;&gt;Getting Started With Python Dictionaries&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-python-dictionaries&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Dictionaries are a cornerstone of Python. Many aspects of the language are built around dictionaries. &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;Modules&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt;, objects, &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#globals&quot;&gt;&lt;code&gt;globals()&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#locals&quot;&gt;&lt;code&gt;locals()&lt;/code&gt;&lt;/a&gt; are all examples of how dictionaries are deeply wired into Python’s implementation.&lt;/p&gt;
&lt;p&gt;Here’s how the Python &lt;a href=&quot;https://docs.python.org/3/index.html&quot;&gt;official documentation&lt;/a&gt; defines a dictionary:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;An associative array, where arbitrary keys are mapped to values. The keys can be any object with &lt;code&gt;__hash__()&lt;/code&gt; and &lt;code&gt;__eq__()&lt;/code&gt; methods. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-dictionary&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There are a couple of points to notice in this definition:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Dictionaries map &lt;strong&gt;keys&lt;/strong&gt; to &lt;strong&gt;values&lt;/strong&gt; and store them in an array or &lt;strong&gt;collection&lt;/strong&gt;. The key-value pairs are commonly known as &lt;strong&gt;items&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Dictionary keys must be of a &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-hashable&quot;&gt;hashable&lt;/a&gt; type, which means that they must have a hash value that never changes during the key’s lifetime.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Unlike &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-sequence&quot;&gt;sequences&lt;/a&gt;, which are &lt;a href=&quot;https://realpython.com/python-iterators-iterables/#getting-to-know-python-iterables&quot;&gt;iterables&lt;/a&gt; that support element access using integer indices, dictionaries are indexed by keys. This means that you can access the values stored in a dictionary using the associated key rather than an integer index.&lt;/p&gt;
&lt;p&gt;The keys in a dictionary are much like a &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;&lt;code&gt;set&lt;/code&gt;&lt;/a&gt;, which is a collection of hashable and unique objects. Because the keys need to be hashable, you can’t use &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-mutable&quot;&gt;mutable&lt;/a&gt; objects as dictionary keys.&lt;/p&gt;
&lt;p&gt;On the other hand, dictionary values can be of any Python type, whether they’re hashable or not. There are literally no restrictions for values. You can use anything as a value in a Python dictionary.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The concepts and topics that you’ll learn about in this section and throughout this tutorial refer to the &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;CPython&lt;/a&gt; implementation of Python. Other implementations, such as &lt;a href=&quot;https://realpython.com/pypy-faster-python/&quot;&gt;PyPy&lt;/a&gt;, &lt;a href=&quot;http://ironpython.net/&quot;&gt;IronPython&lt;/a&gt;, and &lt;a href=&quot;http://www.jython.org/index.html&quot;&gt;Jython&lt;/a&gt;, could exhibit different dictionary behaviors and features that are beyond the scope of this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Before Python 3.6, dictionaries were &lt;em&gt;unordered&lt;/em&gt; data structures. This means that the order of items typically wouldn’t match the insertion order:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Python 3.5&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;likes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;color&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;fruit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;dog&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;likes&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{&#x27;color&#x27;: &#x27;blue&#x27;, &#x27;pet&#x27;: &#x27;dog&#x27;, &#x27;fruit&#x27;: &#x27;apple&#x27;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note how the order of items in the resulting dictionary doesn’t match the order in which you originally inserted the items.&lt;/p&gt;
&lt;p&gt;In Python 3.6 and greater, the keys and values of a dictionary retain the same order in which you insert them into the underlying dictionary. From 3.6 onward, dictionaries are compact &lt;em&gt;ordered&lt;/em&gt; data structures:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Python 3.6&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;likes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;color&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;fruit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;dog&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;likes&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{&#x27;color&#x27;: &#x27;blue&#x27;, &#x27;fruit&#x27;: &#x27;apple&#x27;, &#x27;pet&#x27;: &#x27;dog&#x27;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Keeping the items in order is a pretty useful feature. However, if you work with code that supports older Python versions, then you must not rely on this feature, because it can generate buggy behaviors. With newer versions, it’s completely safe to rely on the feature.&lt;/p&gt;
&lt;p&gt;Another important feature of dictionaries is that they’re &lt;a href=&quot;https://realpython.com/python-mutable-vs-immutable-types/#dictionaries&quot;&gt;mutable&lt;/a&gt; data types. This means that you can add, delete, and update their items &lt;a href=&quot;https://en.wikipedia.org/wiki/In-place_algorithm&quot;&gt;in place&lt;/a&gt; as needed. It’s worth noting that this mutability also means that you can’t use a dictionary as a key in another dictionary.&lt;/p&gt;
&lt;h2 id=&quot;understanding-how-to-iterate-through-a-dictionary-in-python&quot;&gt;Understanding How to Iterate Through a Dictionary in Python&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-how-to-iterate-through-a-dictionary-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/iterate-through-dictionary-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/iterate-through-dictionary-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #169: Improving Classification Models With XGBoost</title>
      <id>https://realpython.com/podcasts/rpp/169/</id>
      <link href="https://realpython.com/podcasts/rpp/169/"/>
      <updated>2023-08-25T12:00:00+00:00</updated>
      <summary>How can you improve a classification model while avoiding overfitting? Once you have a model, what tools can you use to explain it to others? This week on the show, we talk with author and Python trainer Matt Harrison about his new book Effective XGBoost: Tuning, Understanding, and Deploying Classification Models.</summary>
      <content type="html">
        &lt;p&gt;How can you improve a classification model while avoiding overfitting? Once you have a model, what tools can you use to explain it to others? This week on the show, we talk with author and Python trainer Matt Harrison about his new book Effective XGBoost: Tuning, Understanding, and Deploying Classification Models.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Click and Python: Build Extensible and Composable CLI Apps</title>
      <id>https://realpython.com/python-click/</id>
      <link href="https://realpython.com/python-click/"/>
      <updated>2023-08-23T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use the Click library to build robust, extensible, and user-friendly command-line interfaces (CLI) for your Python automation and tooling scripts.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;You can use the &lt;strong&gt;Click&lt;/strong&gt; library to quickly provide your Python automation and tooling scripts with an extensible, composable, and user-friendly &lt;a href=&quot;https://en.wikipedia.org/wiki/Command-line_interface&quot;&gt;command-line interface (CLI)&lt;/a&gt;. Whether you’re a developer, data scientist, DevOps engineer, or someone who often uses Python to automate repetitive tasks, you’ll very much appreciate Click and its unique features.&lt;/p&gt;
&lt;p&gt;In the Python ecosystem, you’ll find multiple libraries for creating CLIs, including &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;&lt;code&gt;argparse&lt;/code&gt;&lt;/a&gt; from the &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-typer-cli/&quot;&gt;Typer&lt;/a&gt;, and a few others. However, Click offers a robust, mature, intuitive, and feature-rich solution.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;strong&gt;command-line interfaces&lt;/strong&gt; with &lt;strong&gt;Click&lt;/strong&gt; and Python&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;arguments&lt;/strong&gt;, &lt;strong&gt;options&lt;/strong&gt;, and &lt;strong&gt;subcommands&lt;/strong&gt; to your CLI apps&lt;/li&gt;
&lt;li&gt;Enhance the &lt;strong&gt;usage&lt;/strong&gt; and &lt;strong&gt;help pages&lt;/strong&gt; of your CLI apps with Click&lt;/li&gt;
&lt;li&gt;Prepare a Click CLI app for &lt;strong&gt;installation&lt;/strong&gt;, &lt;strong&gt;use&lt;/strong&gt;, and &lt;strong&gt;distribution&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a good understanding of Python programming, including topics such as using &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt;. It’ll also be helpful if you’re familiar with using your current operating system’s command line or &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;terminal&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-click-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-click-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that you’ll use to build your CLI app with Click and Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;creating-command-line-interfaces-with-click-and-python&quot;&gt;Creating Command-Line Interfaces With Click and Python&lt;a class=&quot;headerlink&quot; href=&quot;#creating-command-line-interfaces-with-click-and-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://click.palletsprojects.com/en/8.0.x/&quot;&gt;Click&lt;/a&gt; library enables you to quickly create robust, feature-rich, and extensible &lt;a href=&quot;https://realpython.com/python-command-line-arguments/#the-command-line-interface&quot;&gt;command-line interfaces (CLIs)&lt;/a&gt; for your scripts and tools. This library can significantly speed up your development process because it allows you to focus on the application’s logic and leave CLI creation and management to the library itself.&lt;/p&gt;
&lt;p&gt;Click is a great alternative to the &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;&lt;code&gt;argparse&lt;/code&gt;&lt;/a&gt; module, which is the default CLI framework in the Python standard library. Next up, you’ll learn what sets it apart.&lt;/p&gt;
&lt;h3 id=&quot;why-use-click-for-cli-development&quot;&gt;Why Use Click for CLI Development&lt;a class=&quot;headerlink&quot; href=&quot;#why-use-click-for-cli-development&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Compared with &lt;code&gt;argparse&lt;/code&gt;, Click provides a more flexible and intuitive framework for creating CLI apps that are highly extensible. It allows you to gradually compose your apps without restrictions and with a minimal amount of code. This code will be readable even when your CLI grows and becomes more complex.&lt;/p&gt;
&lt;p&gt;Click’s &lt;a href=&quot;https://en.wikipedia.org/wiki/API&quot;&gt;application programming interface (API)&lt;/a&gt; is highly intuitive and consistent. The API takes advantage of Python &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt;, allowing you to add &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/#commands-arguments-options-parameters-and-subcommands&quot;&gt;arguments, options, and subcommands&lt;/a&gt; to your CLIs quickly.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;Functions&lt;/a&gt; are fundamental in Click-based CLIs. You have to write functions that you can then wrap with the appropriate decorators to create arguments, commands, and so on.&lt;/p&gt;
&lt;p&gt;Click has several desirable features that you can take advantage of. For example, Click apps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can be &lt;strong&gt;lazily composable&lt;/strong&gt; without restrictions&lt;/li&gt;
&lt;li&gt;Follow the &lt;a href=&quot;https://en.wikipedia.org/wiki/Unix-like&quot;&gt;Unix&lt;/a&gt; &lt;strong&gt;command-line conventions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Support loading values from &lt;strong&gt;environment variables&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Support custom &lt;strong&gt;prompts&lt;/strong&gt; for input values&lt;/li&gt;
&lt;li&gt;Handle &lt;strong&gt;paths&lt;/strong&gt; and &lt;strong&gt;files&lt;/strong&gt; out of the box&lt;/li&gt;
&lt;li&gt;Allow arbitrary nesting of commands, also known as &lt;strong&gt;subcommands&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll find that Click has many other cool features. For example, Click keeps information about all of your arguments, options, and commands. This way, it can generate usage and help pages for the CLI, which improves the user experience.&lt;/p&gt;
&lt;p&gt;When it comes to processing user input, Click has a strong understanding of data types. Because of this feature, the library generates consistent error messages when the user provides the wrong type of input.&lt;/p&gt;
&lt;p&gt;Now that you have a general understanding of Click’s most relevant features, it’s time to get your hands dirty and write your first Click app.&lt;/p&gt;
&lt;h3 id=&quot;how-to-install-and-set-up-click-your-first-cli-app&quot;&gt;How to Install and Set Up Click: Your First CLI App&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-install-and-set-up-click-your-first-cli-app&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Unlike &lt;code&gt;argparse&lt;/code&gt;, Click doesn’t come in the Python standard library. This means that you need to install Click as a dependency of your CLI project to use the library. You can install Click from &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt; using &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. First, you should create a Python &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; to work on. You can do all of that with the following platform-specific commands:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-windows&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body active small&quot; id=&quot;windows-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-1&quot; role=&quot;tab&quot; aria-controls=&quot;windows-1&quot; aria-selected=&quot;true&quot;&gt;&lt;i class=&quot;fa fa-windows text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;Windows&lt;/a&gt;
  &lt;/li&gt;




  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linuxmacos&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small&quot; id=&quot;macos-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-1&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-1&quot; aria-selected=&quot;false&quot;&gt;&lt;i class=&quot;fa fa-linux text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;&lt;i class=&quot;fa fa-apple text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;Linux + macOS&lt;/a&gt;
  &lt;/li&gt;

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight doscon&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt;&lt;/span&gt; python -m venv venv
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt;&lt;/span&gt; venv\Scripts\activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt;&lt;/span&gt; python -m pip install click
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;click
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;With the first two commands, you create and activate a Python virtual environment called &lt;code&gt;venv&lt;/code&gt; in your working directory. Once the environment is active, you install Click using &lt;code&gt;pip&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Great! You’ve installed Click in a fresh virtual environment. Now go ahead and fire up your favorite &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;code editor&lt;/a&gt;. Create a new &lt;code&gt;hello.py&lt;/code&gt; file and add the following content to it:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# hello.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;click&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;@click&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nd&quot;&gt;@click&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;version_option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;prog_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;vm&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;__main__&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-click/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-click/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Replacing a String in Python</title>
      <id>https://realpython.com/courses/replace-string-python/</id>
      <link href="https://realpython.com/courses/replace-string-python/"/>
      <updated>2023-08-22T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to remove or replace a string or substring. You&#x27;ll go from the basic string method .replace() all the way up to a multi-layer regex pattern using the sub() function from Python&#x27;s re module.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re looking for ways to remove or replace all or part of a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt; in Python, then this course is for you. You&amp;rsquo;ll be taking a fictional chat room transcript and &lt;a href=&quot;https://en.wikipedia.org/wiki/Sanitization_(classified_information)&quot;&gt;sanitizing&lt;/a&gt; it using both the &lt;strong&gt;&lt;code&gt;.replace()&lt;/code&gt; method&lt;/strong&gt; and the &lt;strong&gt;&lt;code&gt;re.sub()&lt;/code&gt; function&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In Python, the &lt;code&gt;.replace()&lt;/code&gt; method and the &lt;code&gt;re.sub()&lt;/code&gt; function are often used to clean up text by removing strings or substrings or replacing them. In this tutorial, you&amp;rsquo;ll be playing the role of a developer for a company that provides technical support through a one-to-one text chat. You&amp;rsquo;re tasked with creating a script that&amp;rsquo;ll sanitize the chat, removing any &lt;a href=&quot;https://en.wikipedia.org/wiki/Personal_data&quot;&gt;personal data&lt;/a&gt; and replacing any swear words with emoji.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;re only given one very short chat transcript:&lt;/p&gt;
&lt;div class=&quot;highlight text&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with?
[johndoe] 2022-08-24T10:03:15+00:00 : I CAN&amp;#39;T CONNECT TO MY BLASTED ACCOUNT
[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it&amp;#39;s not your caps lock?
[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You&amp;#39;re right!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Even though this transcript is short, it&amp;rsquo;s typical of the type of chats that agents have all the time. It has user identifiers, &lt;a href=&quot;https://en.wikipedia.org/wiki/ISO_8601&quot;&gt;ISO time stamps&lt;/a&gt;, and messages.&lt;/p&gt;
&lt;p&gt;In this case, the client &lt;code&gt;johndoe&lt;/code&gt; filed a complaint, and company policy is to sanitize and simplify the transcript, then pass it on for independent evaluation. Sanitizing the message is your job, and that&amp;rsquo;s what you&amp;rsquo;ll tackle in this video course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Build a Code Image Generator With Python</title>
      <id>https://realpython.com/python-code-image-generator/</id>
      <link href="https://realpython.com/python-code-image-generator/"/>
      <updated>2023-08-21T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll build a code image generator that creates nice-looking images of your code snippets to share on social media. Your code image generator will be powered by the Flask web framework and include exciting packages like Pygments and Playwright.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’re active on social media, then you know that images and videos are popular forms of content. As a programmer, you mainly work with text, so sharing the content that you create on a daily basis may not seem intuitive. That’s where a code image generator can come in handy for you!&lt;/p&gt;
&lt;p&gt;With a code image generator, you can create a nice-looking image of your code snippets. That way, you can share code without worrying about formatting, different syntax highlighting, or character count limitations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this step-by-step tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up and run a &lt;strong&gt;Flask project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Connect and style &lt;strong&gt;Jinja templates&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Playwright&lt;/strong&gt; to create images&lt;/li&gt;
&lt;li&gt;Beautify code with &lt;strong&gt;Pygments&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Leverage &lt;strong&gt;sessions&lt;/strong&gt; to save browser states&lt;/li&gt;
&lt;li&gt;Enhance the user experience with &lt;strong&gt;JavaScript&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Creating your own code image generator will allow you to hone your skills as a Python programmer and experiment with full-stack web development.&lt;/p&gt;
&lt;p&gt;Although you’ll find plenty of full-featured code image generators like &lt;a href=&quot;https://carbon.now.sh/&quot;&gt;carbon&lt;/a&gt; or &lt;a href=&quot;https://ray.so/&quot;&gt;ray.so&lt;/a&gt;, crafting a custom tool will allow you to meet your specific needs and continue to improve it later on.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-code-image-generator-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-code-image-generator-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; for your Python code image generator.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-a-code-image-generator-with-python&quot;&gt;Demo: A Code Image Generator With Python&lt;a class=&quot;headerlink&quot; href=&quot;#demo-a-code-image-generator-with-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The code image generator is a Flask project that creates stylish screenshots of a code snippet with the help of Pygments and Playwright. The project will run locally in your browser, and you have full control over the look of the code that you want to share:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/852591673?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;Once you run the Flask server, you can visit the application in the browser, add your own Python code, select a style, and download an image of the code to your computer.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll build the code image generator in multiple steps. In each step, you’ll focus on one important area of your codebase.&lt;/p&gt;
&lt;p&gt;After setting up the project, you’ll notice that the structure of the tutorial mirrors the route that a user would take when using your tool. You start by creating the pages and functions to accept code input from the user.&lt;/p&gt;
&lt;p&gt;Then, you move on to implementing the selection of syntax highlighting styles. This will make a user’s code snippet look good when you build the route to generate an image of the code in the following step.&lt;/p&gt;
&lt;p&gt;Finally, you’ll have a closer look at some areas of your project and improve the user experience. At the end of the tutorial, you’ll have your very own code image generator that’s ready to use and highly extensible. &lt;/p&gt;
&lt;p&gt;Over the course of the tutorial, you’ll get guidance on which files and folders to create. In the end, your project layout will look like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;code-image-generator/
│
├── static/
│   └── styles.css
│
├── templates/
│   ├── base.html
│   ├── code_input.html
│   ├── image.html
│   └── style_selection.html
│
├── app.py
└── utils.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the materials for this tutorial, you’ll find a folder for each step, containing source code of the project in its current state:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-code-image-generator-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-code-image-generator-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; for your Python code image generator.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;At the end of each step, you can compare your own code with the source code while following along. If you have questions about a step or you’re stuck at some point, then you can scroll down to the comments area and ask the Real Python community for help.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll build a code image generator with Python, Flask, Pygments, and Playwright. While working through the steps, it’ll be helpful if you’re comfortable with the following concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/primer-on-jinja-templating/&quot;&gt;Jinja templating&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML and CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;Python decorators&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’re not confident in your knowledge of these prerequisites, then that’s okay too! In fact, going through this tutorial will help you learn and practice these concepts. You can always stop and review the resources linked above if you get stuck.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-code-image-generator/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-code-image-generator/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Polars: A Lightning-Fast DataFrame Library</title>
      <id>https://realpython.com/polars-python/</id>
      <link href="https://realpython.com/polars-python/"/>
      <updated>2023-08-16T14:00:00+00:00</updated>
      <summary>Welcome to the world of Polars, a powerful DataFrame library for Python! In this showcase tutorial, you&#x27;ll get a hands-on introduction to Polars&#x27; core features and see why this library is catching so much buzz.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In the world of data analysis and manipulation, Python has long been the go-to language. With extensive and user-friendly libraries like &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/learning-paths/pandas-data-science/&quot;&gt;pandas&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/pyspark-intro/&quot;&gt;PySpark&lt;/a&gt;, and &lt;a href=&quot;https://tutorial.dask.org/00_overview.html&quot;&gt;Dask&lt;/a&gt;, there’s a solution available for almost any data-driven task. Among these libraries, one name that’s been generating a significant amount of buzz lately is &lt;a href=&quot;https://pola-rs.github.io/polars-book/&quot;&gt;Polars&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Polars is a high-performance DataFrame library, designed to provide fast and efficient data processing capabilities. Inspired by the reigning pandas library, Polars takes things to another level, offering a seamless experience for working with large datasets that might not fit into memory.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why Polars is so &lt;strong&gt;performant&lt;/strong&gt; and attention-grabbing&lt;/li&gt;
&lt;li&gt;How to work with &lt;strong&gt;DataFrames&lt;/strong&gt;, &lt;strong&gt;expressions&lt;/strong&gt;, and &lt;strong&gt;contexts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;lazy API&lt;/strong&gt; is and how to use it&lt;/li&gt;
&lt;li&gt;How to integrate Polars with &lt;strong&gt;external data sources&lt;/strong&gt; and the broader Python ecosystem&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After reading, you’ll be equipped with the knowledge and resources necessary to get started using Polars for your own data tasks. Before reading, you’ll benefit from having a basic knowledge of Python and experience working with tabular datasets.
You should also be comfortable with DataFrames from any of the popular DataFrame libraries.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/polars-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-polars-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to optimize your data processing with the Python Polars library.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;the-python-polars-library&quot;&gt;The Python Polars Library&lt;a class=&quot;headerlink&quot; href=&quot;#the-python-polars-library&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Polars has caught a lot of attention in a short amount of time, and for good reason. In this first section, you’ll get an overview of Polars and a preview of the library’s powerful features. You’ll also learn how to install Polars along with any dependencies that you might need for your data processing task.&lt;/p&gt;
&lt;h3 id=&quot;getting-to-know-polars&quot;&gt;Getting to Know Polars&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-polars&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Polars combines the flexibility and user-friendliness of Python with the speed and scalability of &lt;a href=&quot;https://www.rust-lang.org/&quot;&gt;Rust&lt;/a&gt;, making it a compelling choice for a wide range of data processing tasks. So, what makes Polars stand out among the crowd? There are many reasons, one of the most prominent being that Polars is lightning fast.&lt;/p&gt;
&lt;p&gt;The core of Polars is written in Rust, a language that operates at a low level with no external dependencies. Rust is memory-efficient and gives you performance on par with &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt;, making it a great language to underpin a data analysis library. Polars also ensures that you can utilize all available CPU cores in parallel, and it supports large datasets without requiring all data to be in memory.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you want to take a deeper dive into Polars’ features, check out &lt;a href=&quot;https://realpython.com/podcasts/rpp/140/&quot;&gt;this Real Python Podcast episode&lt;/a&gt; with Liam Brannigan. Liam is a Polars contributor, and he offers a nice firsthand perspective on Polars’ capabilities.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Another standout feature of Polars is its intuitive API. If you’re already familiar with libraries like pandas, then you’ll feel right at home with Polars. The library provides a familiar yet unique interface, making it easy to transition to Polars. This means you can leverage your existing knowledge and codebase while taking advantage of Polars’ performance gains.&lt;/p&gt;
&lt;p&gt;Polars’ query engine leverages &lt;a href=&quot;https://arrow.apache.org/&quot;&gt;Apache Arrow&lt;/a&gt; to execute &lt;a href=&quot;https://www.sciencedirect.com/topics/computer-science/vectorization&quot;&gt;vectorized&lt;/a&gt; queries. Exploiting the power of &lt;a href=&quot;https://en.wikipedia.org/wiki/Column-oriented_DBMS&quot;&gt;columnar&lt;/a&gt; data storage, Apache Arrow is a development platform designed for fast in-memory processing. This is yet another rich feature that gives Polars an outstanding performance boost.&lt;/p&gt;
&lt;p&gt;These are just a few key details that make Polars an attractive data processing library, and you’ll get to see these in action throughout this tutorial. Up next, you’ll get an overview of how to install Polars.&lt;/p&gt;
&lt;h3 id=&quot;installing-python-polars&quot;&gt;Installing Python Polars&lt;a class=&quot;headerlink&quot; href=&quot;#installing-python-polars&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Before installing Polars, make sure you have Python and &lt;code&gt;pip&lt;/code&gt; installed on your system. Polars supports Python versions 3.7 and above. To check your Python version, open a terminal or command prompt and run the following command:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;--version
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you have Python installed, then you’ll see the version number displayed below the command. If you don’t have Python 3.7 or above installed, follow &lt;a href=&quot;https://realpython.com/installing-python/&quot;&gt;these&lt;/a&gt; instructions to get the correct version.&lt;/p&gt;
&lt;p&gt;Polars is available on &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt;, and you can install it with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. Open a terminal or command prompt, create a new &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;, and then run the following command to install Polars:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;polars
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command will install the latest version of Polars from PyPI onto your machine. To verify that the installation was successful, start a &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;Python REPL&lt;/a&gt; and import Polars:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;polars&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pl&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If the import runs without error, then you’ve successfully installed Polars. You now have the core of Polars installed on your system. This is a lightweight installation of Polars that allows you to get started without extra dependencies.&lt;/p&gt;
&lt;p&gt;Polars has other rich features that allow you to interact with the broader Python ecosystem and external data sources. To use these features, you need to install Polars with the &lt;a href=&quot;https://pola-rs.github.io/polars-book/user-guide/installation/#importing:~:text=polars%20as%20pl-,Feature%20Flags,-By%20using%20the&quot;&gt;feature flags&lt;/a&gt; that you’re interested in. For example, if you want to convert Polars DataFrames to pandas DataFrames and NumPy arrays, then run the following command when installing Polars:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/polars-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/polars-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Process Images Using the Pillow Library and Python</title>
      <id>https://realpython.com/courses/python-pillow/</id>
      <link href="https://realpython.com/courses/python-pillow/"/>
      <updated>2023-08-15T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use the Python Pillow library to deal with images and perform image processing. You&#x27;ll also explore using NumPy for further processing, including to create animations.</summary>
      <content type="html">
        &lt;p&gt;When you look at an image, you see the objects and people in it. However, when you read an image programmatically with Python or any other language, the computer sees an array of numbers. In this video course, you&amp;rsquo;ll learn how to manipulate images and perform basic image processing using the Python Pillow library.&lt;/p&gt;
&lt;p&gt;Pillow and its predecessor, PIL, are the original Python libraries for dealing with images. Even though there are other Python libraries for image processing, Pillow remains an important tool for understanding and dealing with images.&lt;/p&gt;
&lt;p&gt;To manipulate and process images, Pillow provides tools that are similar to ones found in image processing software such as Photoshop. Some of the more modern Python image processing libraries are built on top of Pillow and often provide more advanced functionality.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Read images&lt;/strong&gt; with Pillow&lt;/li&gt;
&lt;li&gt;Perform &lt;strong&gt;basic image manipulation&lt;/strong&gt; operations&lt;/li&gt;
&lt;li&gt;Use Pillow for &lt;strong&gt;image processing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;NumPy&lt;/strong&gt; with Pillow for &lt;strong&gt;further processing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create animations&lt;/strong&gt; using Pillow&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll get an overview of what you can achieve with the Python Pillow library through some of its most common methods. Once you gain confidence using these methods, then you can use Pillow&amp;rsquo;s &lt;a href=&quot;https://pillow.readthedocs.io/en/stable/reference/index.html&quot;&gt;documentation&lt;/a&gt; to explore the rest of the methods in the library. If you&amp;rsquo;ve never worked with images in Python before, this is a great opportunity to jump right in!&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #168: Common Python Stumbling Blocks &amp; Quirky Behaviors</title>
      <id>https://realpython.com/podcasts/rpp/168/</id>
      <link href="https://realpython.com/podcasts/rpp/168/"/>
      <updated>2023-08-11T12:00:00+00:00</updated>
      <summary>Have you ever encountered strange behavior when trying something new in Python? What are common quirks hiding within the language? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you ever encountered strange behavior when trying something new in Python? What are common quirks hiding within the language? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>What Does if __name__ == &quot;__main__&quot; Mean in Python?</title>
      <id>https://realpython.com/courses/if-name-main-python/</id>
      <link href="https://realpython.com/courses/if-name-main-python/"/>
      <updated>2023-08-08T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn all about Python&#x27;s name-main idiom. You&#x27;ll learn what it does in Python, how it works, when to use it, when to avoid it, and how to refer to it.</summary>
      <content type="html">
        &lt;p&gt;You&amp;rsquo;ve likely encountered Python&amp;rsquo;s &lt;code&gt;if __name__ == &quot;__main__&quot;&lt;/code&gt; idiom when reading other people&amp;rsquo;s code. You might have even used &lt;code&gt;if __name__ == &quot;__main__&quot;&lt;/code&gt; in your own scripts. But did you use it correctly?&lt;/p&gt;
&lt;p&gt;This line of code can seem a little cryptic, so don&amp;rsquo;t fret if you&amp;rsquo;re not completely sure &lt;strong&gt;what&lt;/strong&gt; it does, &lt;strong&gt;why&lt;/strong&gt; you might want it, and &lt;strong&gt;when&lt;/strong&gt; to use it.&lt;/p&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll learn all about Python&amp;rsquo;s &lt;code&gt;if __name__ == &quot;__main__&quot;&lt;/code&gt; idiom.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #167: Exploring pandas 2.0 &amp; Targets for Apache Arrow</title>
      <id>https://realpython.com/podcasts/rpp/167/</id>
      <link href="https://realpython.com/podcasts/rpp/167/"/>
      <updated>2023-08-04T12:00:00+00:00</updated>
      <summary>What are the new ways to describe your data in pandas 2.0? Will the addition of Apache Arrow to the data back end foster the growth of data interoperability? This week on the show, we talk with pandas core developer Marc Garcia about the release of pandas 2.0.</summary>
      <content type="html">
        &lt;p&gt;What are the new ways to describe your data in pandas 2.0? Will the addition of Apache Arrow to the data back end foster the growth of data interoperability? This week on the show, we talk with pandas core developer Marc Garcia about the release of pandas 2.0.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Reversing Strings in Python</title>
      <id>https://realpython.com/courses/python-reverse-string/</id>
      <link href="https://realpython.com/courses/python-reverse-string/"/>
      <updated>2023-08-01T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to reverse strings in Python by using available tools such as reversed() and slicing operations. You&#x27;ll also learn how to build reversed strings by hand.</summary>
      <content type="html">
        &lt;p&gt;When you&amp;rsquo;re using Python strings often in your code, you may face the need to work with them in &lt;strong&gt;reverse order&lt;/strong&gt;. Python includes a few handy tools and techniques that can help you out in these situations. With them, you&amp;rsquo;ll be able to build reversed copies of existing strings quickly and efficiently.&lt;/p&gt;
&lt;p&gt;Knowing about these tools and techniques for reversing strings in Python will help you improve your proficiency as a Python developer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Quickly build reversed strings through &lt;strong&gt;slicing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;reversed copies&lt;/strong&gt; of existing strings using &lt;code&gt;reversed()&lt;/code&gt; and &lt;code&gt;.join()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;iteration&lt;/strong&gt; to reverse existing strings manually&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To make the most out of this course, you should know the basics of &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;&lt;code&gt;while&lt;/code&gt;&lt;/a&gt; loops.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #166: Differentiating the Versions of Python &amp; Unlocking IPython&#x27;s Magic</title>
      <id>https://realpython.com/podcasts/rpp/166/</id>
      <link href="https://realpython.com/podcasts/rpp/166/"/>
      <updated>2023-07-28T12:00:00+00:00</updated>
      <summary>What are all the different versions of Python? You may have heard of Cython, Brython, PyPy, or others and wondered where they fit into the Python landscape. This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What are all the different versions of Python? You may have heard of Cython, Brython, PyPy, or others and wondered where they fit into the Python landscape. This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Socket Programming in Python Part 1: Handling Connections</title>
      <id>https://realpython.com/courses/python-sockets-part-1/</id>
      <link href="https://realpython.com/courses/python-sockets-part-1/"/>
      <updated>2023-07-25T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to build a socket server and client with Python. Along the way, you&#x27;ll get to know the main functions and methods in Python&#x27;s socket module, and you&#x27;ll implement a multi-connection server and client.</summary>
      <content type="html">
        &lt;p&gt;Sockets and the socket API are used to send messages across a network. They provide a form of &lt;a href=&quot;https://en.wikipedia.org/wiki/Inter-process_communication&quot;&gt;inter-process communication (IPC)&lt;/a&gt;. The network can be a logical, local network to the computer, or one that&amp;rsquo;s physically connected to an external network, with its own connections to other networks. The obvious example is the Internet, which you connect to with your ISP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this two-part series, you&amp;rsquo;ll create:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A simple &lt;strong&gt;socket server and client&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;An improved version that handles &lt;strong&gt;multiple connections&lt;/strong&gt; simultaneously&lt;/li&gt;
&lt;li&gt;A server-client application that functions like a full-fledged &lt;strong&gt;socket application&lt;/strong&gt;, complete with its own &lt;strong&gt;custom header and content&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end of part one, you&amp;rsquo;ll understand how to use the main functions and methods in Python&amp;rsquo;s &lt;a href=&quot;https://docs.python.org/3/library/socket.html&quot;&gt;socket module&lt;/a&gt; to write your own client-server applications, including ones with multiple connections. In part two, you&amp;rsquo;ll dive into building a custom class and handling errors.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #165: Leveraging the Features of Your Database With Postgres and Python</title>
      <id>https://realpython.com/podcasts/rpp/165/</id>
      <link href="https://realpython.com/podcasts/rpp/165/"/>
      <updated>2023-07-21T12:00:00+00:00</updated>
      <summary>Are you getting the most out of your Postgres database? What features could you leverage to improve your Python project? This week on the show, Craig Kerstiens from Crunchy Data is here to discuss getting the most out of Postgres.</summary>
      <content type="html">
        &lt;p&gt;Are you getting the most out of your Postgres database? What features could you leverage to improve your Python project? This week on the show, Craig Kerstiens from Crunchy Data is here to discuss getting the most out of Postgres.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Creating Web Maps From Your Data With Python Folium</title>
      <id>https://realpython.com/courses/python-folium-web-maps-from-data/</id>
      <link href="https://realpython.com/courses/python-folium-web-maps-from-data/"/>
      <updated>2023-07-18T14:00:00+00:00</updated>
      <summary>You&#x27;ll learn how to create web maps from data using Folium. The package combines Python&#x27;s data-wrangling strengths with the data-visualization power of the JavaScript library Leaflet. In this video course, you&#x27;ll create and style a choropleth world map showing the ecological footprint per country.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re working with geospatial data in Python, then you might want to quickly visualize that data on a map. Python&amp;rsquo;s Folium library gives you access to the mapping strengths of the &lt;a href=&quot;https://leafletjs.com/&quot;&gt;Leaflet&lt;/a&gt; JavaScript library through a Python API. It allows you to create interactive geographic visualizations that you can &lt;a href=&quot;https://realpython.github.io/ecological-footprint/&quot;&gt;share as a website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll build a web map that displays the &lt;a href=&quot;https://en.wikipedia.org/wiki/Ecological_footprint&quot;&gt;ecological footprint&lt;/a&gt; per capita of many countries and is based on a &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_countries_by_ecological_footprint#/media/File:Ecological_footprint_2018.png&quot;&gt;similar map on Wikipedia&lt;/a&gt;. Along the way, you&amp;rsquo;ll learn the basics of using Folium for data visualization.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create an &lt;strong&gt;interactive map&lt;/strong&gt; using Folium and save it as an &lt;strong&gt;HTML&lt;/strong&gt; file&lt;/li&gt;
&lt;li&gt;Choose from different &lt;strong&gt;web map tiles&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Anchor your map to a &lt;strong&gt;specific geolocation&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bind data&lt;/strong&gt; to a &lt;strong&gt;GeoJSON&lt;/strong&gt; layer to create a &lt;strong&gt;choropleth map&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Style&lt;/strong&gt; the choropleth map&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll use Folium inside of a &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter notebook&lt;/a&gt;, so the Folium library will render your maps directly in the Jupyter notebook. This gives you a good opportunity to visually explore a geographical dataset or include a map in your data science report.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #164: Constructing Python Library APIs &amp; Tackling Jinja Templating</title>
      <id>https://realpython.com/podcasts/rpp/164/</id>
      <link href="https://realpython.com/podcasts/rpp/164/"/>
      <updated>2023-07-14T12:00:00+00:00</updated>
      <summary>What principles should you consider when designing a Python library? How do you construct a library API that&#x27;s understandable and easy to use? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What principles should you consider when designing a Python library? How do you construct a library API that&#x27;s understandable and easy to use? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #163: Python Crash Course &amp; Learning Enough to Start Creating</title>
      <id>https://realpython.com/podcasts/rpp/163/</id>
      <link href="https://realpython.com/podcasts/rpp/163/"/>
      <updated>2023-07-07T12:00:00+00:00</updated>
      <summary>How much Python do you need to learn to start creating projects? What&#x27;s a good balance of information and hands-on practice? This week on the show, Eric Matthes is here to discuss his book Python Crash Course.</summary>
      <content type="html">
        &lt;p&gt;How much Python do you need to learn to start creating projects? What&#x27;s a good balance of information and hands-on practice? This week on the show, Eric Matthes is here to discuss his book Python Crash Course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  

</feed>
