<?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>2021-06-15T14:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>Using Pandas to Make a Gradebook in Python</title>
      <id>https://realpython.com/courses/gradebook-using-pandas-python/</id>
      <link href="https://realpython.com/courses/gradebook-using-pandas-python/"/>
      <updated>2021-06-15T14:00:00+00:00</updated>
      <summary>With this Python project, you&#x27;ll build a script to calculate grades for a class using pandas. The script will quickly and accurately calculate grades from a variety of data sources. You&#x27;ll see examples of loading, merging, and saving data with pandas, as well as plotting some summary statistics.</summary>
      <content type="html">
        &lt;p&gt;One of the jobs that all teachers have in common is &lt;strong&gt;evaluating students&lt;/strong&gt;. Whether you use exams, homework assignments, quizzes, or projects, you usually have to turn students&amp;rsquo; scores into a &lt;strong&gt;letter grade&lt;/strong&gt; at the end of the term. This often involves a bunch of calculations that you might do in a spreadsheet. Instead, you can consider using Python and &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;pandas&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Load&lt;/strong&gt; and &lt;strong&gt;merge&lt;/strong&gt; data from multiple sources with pandas&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Filter&lt;/strong&gt; and &lt;strong&gt;group&lt;/strong&gt; data in a pandas DataFrame&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Calculate&lt;/strong&gt; and &lt;strong&gt;plot&lt;/strong&gt; grades in a pandas DataFrame&lt;/li&gt;
&lt;/ul&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 Practice Problems: Parsing CSV Files</title>
      <id>https://realpython.com/python-interview-problem-parsing-csv-files/</id>
      <link href="https://realpython.com/python-interview-problem-parsing-csv-files/"/>
      <updated>2021-06-14T20:08:22+00:00</updated>
      <summary>In this tutorial, you&#x27;ll prepare for future interviews by working through a set of Python practice problems that involve CSV files. You&#x27;ll work through the problems yourself and then compare your results with solutions developed by the Real Python team.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Are you a developer looking for some practice with &lt;strong&gt;comma-separated values (CSV) files&lt;/strong&gt; before an upcoming interview? This tutorial will lead you through a series of Python CSV practice problems to help you get ready.&lt;/p&gt;
&lt;p&gt;This tutorial is aimed at intermediate Python developers. It assumes a &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;basic knowledge of Python&lt;/a&gt; and working with &lt;a href=&quot;https://realpython.com/python-csv/&quot;&gt;CSV files&lt;/a&gt;. Like &lt;a href=&quot;https://realpython.com/python-practice-problems/&quot;&gt;other practice problem tutorials&lt;/a&gt;, each of the problems listed here shows the problem description. You’ll see the problem statement first and then have a chance to develop your own solution.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll explore:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Writing code&lt;/strong&gt; for working with CSV files&lt;/li&gt;
&lt;li&gt;Doing &lt;strong&gt;test-driven development&lt;/strong&gt; with pytest&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Discussing your solutions&lt;/strong&gt; and possible enhancements&lt;/li&gt;
&lt;li&gt;The trade-offs between the built-in CSV module and &lt;strong&gt;pandas&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can get skeleton code with failing unit tests for each of the problems you’ll see in this tutorial by clicking 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 the Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/interview-parsing-csv-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-interview-parsing-csv-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to practice parsing CSV files in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;python-csv-parsing-football-scores&quot;&gt;Python CSV Parsing: Football Scores&lt;a class=&quot;headerlink&quot; href=&quot;#python-csv-parsing-football-scores&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Your first problem deals with &lt;a href=&quot;https://en.wikipedia.org/wiki/Premier_League&quot;&gt;English Premier League&lt;/a&gt; team standings. You don’t need any special football knowledge to solve this, just Python!&lt;/p&gt;
&lt;p&gt;As you work through the problem, try to write more unit tests for each bit of functionality and &lt;em&gt;then&lt;/em&gt; write the functionality to make the tests pass. This is known as &lt;a href=&quot;https://realpython.com/courses/test-driven-development-pytest/&quot;&gt;test-driven development&lt;/a&gt;, and it can be a great way to show off not only your coding but also your testing chops!&lt;/p&gt;
&lt;h3 id=&quot;problem-description&quot;&gt;Problem Description&lt;a class=&quot;headerlink&quot; href=&quot;#problem-description&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;For this round of the problem, stick to the standard library &lt;code&gt;csv&lt;/code&gt; module. You’ll get another shot at it using &lt;a href=&quot;https://pandas.pydata.org/&quot;&gt;pandas&lt;/a&gt; later. Here’s your first problem:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Find the Minimum Goal Differential&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Write a program that takes a filename on the command line and processes the contents of a CSV file. The contents will be the end-of-season football standings for the English Premier League. Your program should determine which team had the smallest goal differential that season.&lt;/p&gt;
&lt;p&gt;The first line of the CSV file will be column headers, with each subsequent line showing the data for one team:&lt;/p&gt;
&lt;div class=&quot;highlight csv&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Team,Games,Wins,Losses,Draws,Goals For,Goals Against
Arsenal,38,26,9,3,79,36
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The columns labeled &lt;code&gt;Goals For&lt;/code&gt; and &lt;code&gt;Goals Against&lt;/code&gt; contain the total number of goals scored for and against each team in that season. (So Arsenal scored 79 goals and had 36 goals scored against them.)&lt;/p&gt;
&lt;p&gt;Write a program to read the file, then print the name of the team with the smallest difference in &lt;code&gt;Goals For&lt;/code&gt; and &lt;code&gt;Goals Against&lt;/code&gt;. Create unit tests with pytest to test your program.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There is a single unit test supplied in the skeleton code that tests the problem statement that you’ll see later. You can add more as you write your solution. There are also two &lt;a href=&quot;https://realpython.com/pytest-python-testing/#fixtures-managing-state-and-dependencies&quot;&gt;pytest fixtures&lt;/a&gt; given:&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;# test_football_v1.py&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pytest&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;football_v1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;fb&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;@pytest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fixture&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;mock_csv_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;Team,Games,Wins,Losses,Draws,Goals For,Goals Against&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;Liverpool FC, 38, 32, 3, 3, 85, 33&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;Norwich City FC, 38, 5, 27, 6, 26, 75&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;@pytest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fixture&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;mock_csv_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tmp_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mock_csv_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;datafile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tmp_path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;football.csv&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;datafile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write_text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mock_csv_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datafile&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-interview-problem-parsing-csv-files/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-interview-problem-parsing-csv-files/ »&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 #64: Detecting Deforestation With Python &amp; Using GraphQL With Django and Vue</title>
      <id>https://realpython.com/podcasts/rpp/64/</id>
      <link href="https://realpython.com/podcasts/rpp/64/"/>
      <updated>2021-06-11T12:00:00+00:00</updated>
      <summary>Are you looking for an in-depth data science project to practice your skills on? Perhaps you would like to add new tools to your Python web development projects instead? This week on the show, David Amos is back, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Are you looking for an in-depth data science project to practice your skills on? Perhaps you would like to add new tools to your Python web development projects instead? This week on the show, David Amos is back, and he&#x27;s brought 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>Python&#x27;s filter(): Extract Values From Iterables</title>
      <id>https://realpython.com/python-filter-function/</id>
      <link href="https://realpython.com/python-filter-function/"/>
      <updated>2021-06-09T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how Python&#x27;s filter() works and how to use it effectively in your programs. You&#x27;ll also learn how to use list comprehension and generator expressions to replace filter() and make your code more Pythonic.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;a href=&quot;https://docs.python.org/3/library/functions.html#filter&quot;&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/a&gt; is a built-in function that allows you to process an iterable and extract those items that satisfy a given condition. This process is commonly known as a &lt;strong&gt;filtering&lt;/strong&gt; operation. With &lt;code&gt;filter()&lt;/code&gt;, you can apply a &lt;strong&gt;filtering function&lt;/strong&gt; to an iterable and produce a new iterable with the items that satisfy the condition at hand. In Python, &lt;code&gt;filter()&lt;/code&gt; is one of the tools you can use for &lt;a href=&quot;https://realpython.com/python-functional-programming/&quot;&gt;functional programming&lt;/a&gt;.&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;Use Python’s &lt;strong&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/strong&gt; in your code&lt;/li&gt;
&lt;li&gt;Extract &lt;strong&gt;needed values&lt;/strong&gt; from your iterables&lt;/li&gt;
&lt;li&gt;Combine &lt;code&gt;filter()&lt;/code&gt; with other &lt;strong&gt;functional tools&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Replace&lt;/strong&gt; &lt;code&gt;filter()&lt;/code&gt; with more &lt;strong&gt;Pythonic&lt;/strong&gt; tools&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With this knowledge, you’ll be able to use &lt;code&gt;filter()&lt;/code&gt; effectively in your code. Alternatively, you have the choice of using &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;list comprehensions&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/#building-generators-with-generator-expressions&quot;&gt;generator expressions&lt;/a&gt; to write more &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;Pythonic&lt;/a&gt; and readable code.&lt;/p&gt;
&lt;p&gt;To better understand &lt;code&gt;filter()&lt;/code&gt;, it would be helpful for you to have some previous knowledge on &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterable&quot;&gt;iterables&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-lambda/&quot;&gt;&lt;code&gt;lambda&lt;/code&gt; functions&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-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;coding-with-functional-style-in-python&quot;&gt;Coding With Functional Style in Python&lt;a class=&quot;headerlink&quot; href=&quot;#coding-with-functional-style-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Functional programming&lt;/strong&gt; is a paradigm that promotes using functions to perform almost every task in a program. A pure functional style relies on functions that don’t modify their input arguments and don’t change the program’s state. They just take a specific set of arguments and &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;return&lt;/a&gt; the same result every time. These kinds of functions are known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Pure_function&quot;&gt;pure functions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In functional programming, functions often operate on arrays of data, transform them, and produce new arrays with added features. There are three fundamental operations in functional programming:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Map_(higher-order_function)&quot;&gt;Mapping&lt;/a&gt; applies a transformation function to an iterable and produces a new iterable of transformed items.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Filter_(higher-order_function)&quot;&gt;Filtering&lt;/a&gt; applies a &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean-valued_function&quot;&gt;predicate, or Boolean-valued, function&lt;/a&gt; to an iterable and generates a new iterable containing the items that satisfy the &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean&lt;/a&gt; condition.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fold_(higher-order_function)&quot;&gt;Reducing&lt;/a&gt; applies a reduction function to an iterable and returns a single cumulative value.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Python &lt;a href=&quot;https://web.archive.org/web/20161104183819/http://python-history.blogspot.com.br/2009/04/origins-of-pythons-functional-features.html&quot;&gt;isn’t heavily influenced by functional languages&lt;/a&gt; but by &lt;a href=&quot;https://en.wikipedia.org/wiki/Imperative_programming&quot;&gt;imperative&lt;/a&gt; ones. However, it provides several features that allow you to use a functional style:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-lambda/&quot;&gt;Anonymous functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A &lt;a href=&quot;https://realpython.com/python-map-function/&quot;&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/a&gt; function&lt;/li&gt;
&lt;li&gt;A &lt;a href=&quot;https://docs.python.org/3/library/functions.html#filter&quot;&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/a&gt; function&lt;/li&gt;
&lt;li&gt;A &lt;a href=&quot;https://realpython.com/python-reduce-function/&quot;&gt;&lt;code&gt;reduce()&lt;/code&gt;&lt;/a&gt; function&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Functions in Python are &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/#first-class-objects&quot;&gt;first-class objects&lt;/a&gt;, which means that you can pass them around as you’d do with any other object. You can also use them as arguments and return values of other functions. Functions that accept other functions as arguments or that return functions (or both) are known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Higher-order_function&quot;&gt;higher-order functions&lt;/a&gt;, which are also a desirable feature in functional programming.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn about &lt;code&gt;filter()&lt;/code&gt;. This built-in function is one of the more popular functional tools of Python.&lt;/p&gt;
&lt;h2 id=&quot;understanding-the-filtering-problem&quot;&gt;Understanding the Filtering Problem&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-the-filtering-problem&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Say you need to process a list of &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt; and return a new list containing only those numbers greater than &lt;code&gt;0&lt;/code&gt;. A quick way to approach this problem is to use a &lt;code&gt;for&lt;/code&gt; loop like this:&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;n&quot;&gt;numbers&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;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;extract_positive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;positive_numbers&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;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Filtering condition&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;            &lt;span class=&quot;n&quot;&gt;positive_numbers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;positive_numbers&lt;/span&gt;
&lt;span class=&quot;gp&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;extract_positive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1, 2]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The loop in &lt;code&gt;extract_positive()&lt;/code&gt; iterates through &lt;code&gt;numbers&lt;/code&gt; and stores every number greater than &lt;code&gt;0&lt;/code&gt; in &lt;code&gt;positive_numbers&lt;/code&gt;. The &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statement&lt;/a&gt; &lt;em&gt;filters out&lt;/em&gt; the negative numbers and &lt;code&gt;0&lt;/code&gt;. This kind of functionality is known as a &lt;strong&gt;filtering&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Filtering operations consist of testing each value in an iterable with a &lt;a href=&quot;https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)&quot;&gt;predicate&lt;/a&gt; function and retaining only those values for which the function produces a true result. Filtering operations are fairly common in programming, so most programming languages provide tools to approach them. In the next section, you’ll learn about Python’s way to filter iterables.&lt;/p&gt;
&lt;h2 id=&quot;getting-started-with-pythons-filter&quot;&gt;Getting Started With Python’s &lt;code&gt;filter()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pythons-filter&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python provides a convenient built-in function, &lt;code&gt;filter()&lt;/code&gt;, that abstracts out the logic behind filtering operations. Here’s its signature:&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;nb&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iterable&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;The first argument, &lt;code&gt;function&lt;/code&gt;, must be a single-argument function. Typically, you provide a predicate (Boolean-valued) function to this argument. In other words, you provide a function that returns either &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt; according to a specific condition.&lt;/p&gt;
&lt;p&gt;This &lt;code&gt;function&lt;/code&gt; plays the role of a &lt;strong&gt;decision function&lt;/strong&gt;, also known as a &lt;strong&gt;filtering function&lt;/strong&gt;, because it provides the criteria to filter out unwanted values from the input iterable and to keep those values that you want in the resulting iterable. Note that the term &lt;strong&gt;unwanted values&lt;/strong&gt; refers to those values that evaluate to false when &lt;code&gt;filter()&lt;/code&gt; processes them using &lt;code&gt;function&lt;/code&gt;.&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 first argument to &lt;code&gt;filter()&lt;/code&gt; is a &lt;strong&gt;function object&lt;/strong&gt;, which means that you need to pass a function without calling it with a pair of parentheses.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-filter-function/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-filter-function/ »&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 Basics: Setting Up Python</title>
      <id>https://realpython.com/courses/setting-up-python/</id>
      <link href="https://realpython.com/courses/setting-up-python/"/>
      <updated>2021-06-08T14:00:00+00:00</updated>
      <summary>The first step to getting started with Python is to set it up on your machine. In this course, you&#x27;ll learn how to download Python for Windows, macOS, and Ubuntu Linux and how to open Python&#x27;s Integrated Development and Learning Environment, IDLE.</summary>
      <content type="html">
        &lt;p&gt;Setting up Python is the first step to becoming a Python programmer. In this course, you&amp;rsquo;ll learn how to download and install Python for Windows, macOS, and Ubuntu Linux and how to open &lt;strong&gt;Python&amp;rsquo;s Integrated Development and Learning Environment, IDLE&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;There are many ways to install Python. You can download official Python distributions from &lt;a href=&quot;https://python.org&quot;&gt;Python.org&lt;/a&gt;, install from a package manager, and even install specialized distributions for scientific computing, Internet of Things, and embedded systems. This course focuses on official distributions, as they&amp;rsquo;re generally the best option for getting started with learning to program in Python.&lt;/p&gt;
&lt;p&gt;This course can be enjoyed alone or as an accompaniment to &lt;a href=&quot;http://pythonbasicsbook.com&quot;&gt;Python Basics: A Practical Introduction to Python 3&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install Python on &lt;strong&gt;Windows&lt;/strong&gt;, &lt;strong&gt;macOS&lt;/strong&gt;, and &lt;strong&gt;Linux&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;IDLE&lt;/strong&gt;, Python&amp;rsquo;s integrated development and learning environment&lt;/li&gt;
&lt;/ul&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 Community Interview With Sebastián Ramírez</title>
      <id>https://realpython.com/interview-sebastian-ramirez/</id>
      <link href="https://realpython.com/interview-sebastian-ramirez/"/>
      <updated>2021-06-07T14:00:00+00:00</updated>
      <summary>Sebastián Ramírez is a software developer at Explosion AI and is the creator of the popular frameworks FastAPI and Typer. In this interview, we discuss typing in Python, his motivations for creating FastAPI and the future of the framework, and much more.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Today, I’m joined by &lt;a href=&quot;https://tiangolo.com/&quot;&gt;Sebastián Ramírez&lt;/a&gt;, a software developer at &lt;a href=&quot;https://explosion.ai/&quot;&gt;Explosion AI&lt;/a&gt;. He is also the creator of the popular frameworks &lt;a href=&quot;https://fastapi.tiangolo.com/&quot;&gt;FastAPI&lt;/a&gt; and &lt;a href=&quot;https://typer.tiangolo.com/&quot;&gt;Typer&lt;/a&gt;. In this interview, we discuss typing in Python, his motivations for creating FastAPI and the future of the framework, and much more. Without further ado, let’s get into it.&lt;/p&gt;
&lt;p class=&quot;mt-5&quot;&gt;&lt;strong&gt;Ricky:&lt;/strong&gt; &lt;em&gt;Thanks for joining me, Sebastián. I’d like to start with the same questions I do with all my guests: how did you get into programming, and when did you start using Python?&lt;/em&gt;&lt;/p&gt;
&lt;figure&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid w-25 float-right ml-3 rounded-circle&quot; src=&quot;https://files.realpython.com/media/sebastian-profile.9024e58c2440.jpg&quot; width=&quot;1654&quot; height=&quot;1655&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/sebastian-profile.9024e58c2440.jpg&amp;amp;w=413&amp;amp;sig=9a74bbe10b41bab974836e8fb21985789bbe22b8 413w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/sebastian-profile.9024e58c2440.jpg&amp;amp;w=827&amp;amp;sig=5c9b33ea6e04ab62cfddd8f8408dea848e0599a1 827w, https://files.realpython.com/media/sebastian-profile.9024e58c2440.jpg 1654w&quot; sizes=&quot;75vw&quot; alt=&quot;Sebastián Ramírez Profile Picture&quot; data-asset=&quot;3671&quot;&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Sebastián:&lt;/strong&gt; Thanks for having me 😁&lt;/p&gt;
&lt;p&gt;I got into coding when I was about fifteen, trying to build a website for my parents’ business. The first actual “code” I wrote was some &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt; inside an HTML with an &lt;code&gt;alert(&quot;Hello World&quot;)&lt;/code&gt;. I still remember the rush of excitement seeing that little alert message and the powerful feeling of thinking that &lt;em&gt;I had coded it&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I was afraid to learn any other language for years, thinking I had to “at least” master JavaScript first. Several years later, one of the many online courses I was taking at the time required Python for controlling an AI Pac-Man and other things. The course had a single long-page tutorial with just the basics of Python, and that was enough for that course. I really wanted to try it, so I went ahead with just that basic tutorial. &lt;/p&gt;
&lt;p&gt;Of course, I rapidly fell in love with Python and wished I had started earlier 😅&lt;/p&gt;
&lt;p class=&quot;mt-5&quot;&gt;&lt;strong&gt;Ricky:&lt;/strong&gt; &lt;em&gt;You’re currently a software developer at Explosion AI, the company behind the popular natural language processing (NLP) framework &lt;a href=&quot;https://realpython.com/natural-language-processing-spacy-python/&quot;&gt;spaCy&lt;/a&gt;. Can you speak a little about what your day-to-day looks like? What interests you about artificial intelligence and &lt;a href=&quot;https://realpython.com/learning-paths/machine-learning-python/&quot;&gt;machine learning&lt;/a&gt;, and what tooling has Explosion AI created to help developers push the boundaries in both fields?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sebastián:&lt;/strong&gt; Yep, Explosion is mostly known for &lt;a href=&quot;https://spacy.io/&quot;&gt;spaCy&lt;/a&gt;, the open source NLP toolkit. They also created &lt;a href=&quot;https://prodi.gy/&quot;&gt;Prodigy&lt;/a&gt;, a commercial, scriptable tool for efficiently annotating machine learning datasets. My work has been mainly on &lt;a href=&quot;https://prodi.gy/docs/faq#teams&quot;&gt;Prodigy Teams&lt;/a&gt;, a cloud version of Prodigy focused on teams with multiple users. As the product is very privacy-centric, making a teams/cloud version has many particular challenges.&lt;/p&gt;
&lt;p&gt;Nevertheless, I recently &lt;a href=&quot;https://twitter.com/tiangolo/status/1375066665029865478&quot;&gt;decided to leave the company&lt;/a&gt;. I’m currently (as of the time I’m writing this) finishing all the vacations I had accumulated 😁&lt;/p&gt;
&lt;p&gt;My plan is to arrange a way to dedicate a high percentage of my working time to FastAPI, Typer, and the other open source projects, while probably doing some consulting helping other teams and companies to make it all sustainable 🚀&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/interview-sebastian-ramirez/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/interview-sebastian-ramirez/ »&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 #63: Create Web Applications Using Only Python With Anvil</title>
      <id>https://realpython.com/podcasts/rpp/63/</id>
      <link href="https://realpython.com/podcasts/rpp/63/"/>
      <updated>2021-06-04T12:00:00+00:00</updated>
      <summary>What if you could create an application and deploy it to the web with just Python? Wouldn&#x27;t it be nice to skip the additional full-stack development steps of learning three different languages in addition to Python? That&#x27;s the idea behind Anvil. This week on the show, we have Meredydd Luff, co-founder of Anvil.</summary>
      <content type="html">
        &lt;p&gt;What if you could create an application and deploy it to the web with just Python? Wouldn&#x27;t it be nice to skip the additional full-stack development steps of learning three different languages in addition to Python? That&#x27;s the idea behind Anvil. This week on the show, we have Meredydd Luff, co-founder of Anvil.&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>Context Managers and Python&#x27;s with Statement</title>
      <id>https://realpython.com/python-with-statement/</id>
      <link href="https://realpython.com/python-with-statement/"/>
      <updated>2021-06-02T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn what the Python with statement is and how to use it with existing context managers. You&#x27;ll also learn how to create your own context managers.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;code&gt;with&lt;/code&gt; statement in Python is a quite useful tool for properly managing external resources in your programs. It allows you to take advantage of existing &lt;strong&gt;context managers&lt;/strong&gt; to automatically handle the setup and teardown phases whenever you’re dealing with external resources or with operations that require those phases.&lt;/p&gt;
&lt;p&gt;Besides, the &lt;strong&gt;context management protocol&lt;/strong&gt; allows you to create your own context managers so you can customize the way you deal with system resources. So, what’s the &lt;code&gt;with&lt;/code&gt; statement good for?&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;What the &lt;strong&gt;Python &lt;code&gt;with&lt;/code&gt; statement&lt;/strong&gt; is for and how to use it&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;context management protocol&lt;/strong&gt; is&lt;/li&gt;
&lt;li&gt;How to implement your own &lt;strong&gt;context managers&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With this knowledge, you’ll write more expressive code and avoid &lt;a href=&quot;https://en.wikipedia.org/wiki/Resource_leak&quot;&gt;resource leaks&lt;/a&gt; in your programs. The &lt;code&gt;with&lt;/code&gt; statement helps you implement some common resource management patterns by abstracting their functionality and allowing them to be factored out and reused.&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 Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-tricks-sample-pdf/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-tricks-sample-pdf&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python’s best practices with simple examples you can apply instantly to write more beautiful + Pythonic code.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;managing-resources-in-python&quot;&gt;Managing Resources in Python&lt;a class=&quot;headerlink&quot; href=&quot;#managing-resources-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One common problem you’ll face in programming is how to properly manage &lt;strong&gt;external resources&lt;/strong&gt;, such as &lt;a href=&quot;https://realpython.com/working-with-files-in-python/&quot;&gt;files&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Lock_(computer_science)&quot;&gt;locks&lt;/a&gt;, and network connections. Sometimes, a program will retain those resources forever, even if you no longer need them. This kind of issue is called a &lt;a href=&quot;https://en.wikipedia.org/wiki/Memory_leak&quot;&gt;memory leak&lt;/a&gt; because the available memory gets reduced every time you create and open a new instance of a given resource without closing an existing one.&lt;/p&gt;
&lt;p&gt;Managing resources properly is often a tricky problem. It requires both a &lt;strong&gt;setup&lt;/strong&gt; phase and a &lt;strong&gt;teardown&lt;/strong&gt; phase. The latter phase requires you to perform some cleanup actions, such as closing a file, releasing a lock, or closing a network connection. If you forget to perform these cleanup actions, then your application keeps the resource alive. This might compromise valuable system resources, such as memory and network bandwidth.&lt;/p&gt;
&lt;p&gt;For example, a common problem that can arise when developers are working with databases is when a program keeps creating new connections without releasing or reusing them. In that case, the database &lt;a href=&quot;https://en.wikipedia.org/wiki/Back-end_database&quot;&gt;back end&lt;/a&gt; can stop accepting new connections. This might require an admin to log in and manually kill those stale connections to make the database usable again.&lt;/p&gt;
&lt;p&gt;Another frequent issue shows up when developers are working with files. &lt;a href=&quot;https://realpython.com/read-write-files-python/&quot;&gt;Writing text to files&lt;/a&gt; is usually a buffered operation. This means that calling &lt;code&gt;.write()&lt;/code&gt; on a file won’t immediately result in writing text to the physical file but to a temporary buffer. Sometimes, when the buffer isn’t full and developers forget to call &lt;code&gt;.close()&lt;/code&gt;, part of the data can be lost forever.&lt;/p&gt;
&lt;p&gt;Another possibility is that your application runs into errors or &lt;a href=&quot;https://realpython.com/python-exceptions/&quot;&gt;exceptions&lt;/a&gt; that cause the control flow to bypass the code responsible for releasing the resource at hand. Here’s an example in which you use &lt;a href=&quot;https://docs.python.org/3/library/functions.html#open&quot;&gt;&lt;code&gt;open()&lt;/code&gt;&lt;/a&gt; to write some text to a file:&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;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&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;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&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;This implementation doesn’t guarantee the file will be closed if an exception occurs during the &lt;code&gt;.write()&lt;/code&gt; call. In this case, the code will never call &lt;code&gt;.close()&lt;/code&gt;, and therefore your program might leak a file descriptor.&lt;/p&gt;
&lt;p&gt;In Python, you can use two general approaches to deal with resource management. You can wrap your code in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;a href=&quot;https://realpython.com/python-exceptions/#cleaning-up-after-using-finally&quot;&gt;&lt;code&gt;try&lt;/code&gt; … &lt;code&gt;finally&lt;/code&gt;&lt;/a&gt; construct&lt;/li&gt;
&lt;li&gt;A &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html#the-with-statement&quot;&gt;&lt;code&gt;with&lt;/code&gt;&lt;/a&gt; construct&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first approach is quite general and allows you to provide setup and teardown code to manage any kind of resource. However, it’s a little bit verbose. Also, what if you forget any cleanup actions?&lt;/p&gt;
&lt;p&gt;The second approach provides a straightforward way to provide and reuse setup and teardown code. In this case, you’ll have the limitation that the &lt;code&gt;with&lt;/code&gt; statement only works with &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-context-manager&quot;&gt;context managers&lt;/a&gt;. In the next two sections, you’ll learn how to use both approaches in your code.&lt;/p&gt;
&lt;h3 id=&quot;the-try-finally-approach&quot;&gt;The &lt;code&gt;try&lt;/code&gt; … &lt;code&gt;finally&lt;/code&gt; Approach&lt;a class=&quot;headerlink&quot; href=&quot;#the-try-finally-approach&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Working with files is probably the most common example of resource management in programming. In Python, you can use a &lt;code&gt;try&lt;/code&gt; … &lt;code&gt;finally&lt;/code&gt; statement to handle opening and closing files properly:&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;# Safely open the file&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&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;finally&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Make sure to close the file after using it&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&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;In this example, you need to safely open the file &lt;code&gt;hello.txt&lt;/code&gt;, which you can do by wrapping the call to &lt;code&gt;open()&lt;/code&gt; in a &lt;code&gt;try&lt;/code&gt; … &lt;code&gt;except&lt;/code&gt; statement. Later, when you try to write to &lt;code&gt;file&lt;/code&gt;, the &lt;code&gt;finally&lt;/code&gt; clause will guarantee that &lt;code&gt;file&lt;/code&gt; is properly closed, even if an exception occurs during the call to &lt;code&gt;.write()&lt;/code&gt; in the &lt;code&gt;try&lt;/code&gt; clause. You can use this pattern to handle setup and teardown logic when you’re managing external resources in Python.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;try&lt;/code&gt; block in the above example can potentially raise exceptions, such as &lt;code&gt;AttributeError&lt;/code&gt; or &lt;code&gt;NameError&lt;/code&gt;. You can handle those exceptions in an &lt;code&gt;except&lt;/code&gt; clause like this:&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;# Safely open the file&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&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;except&lt;/span&gt; &lt;span class=&quot;ne&quot;&gt;Exception&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;An error occurred while writing to the file: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Make sure to close the file after using it&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&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;In this example, you catch any potential exceptions that can occur while writing to the file. In real-life situations, you should use a specific &lt;a href=&quot;https://docs.python.org/3/library/exceptions.html#built-in-exceptions&quot;&gt;exception type&lt;/a&gt; instead of the general &lt;a href=&quot;https://docs.python.org/3/library/exceptions.html#Exception&quot;&gt;&lt;code&gt;Exception&lt;/code&gt;&lt;/a&gt; to prevent unknown errors from passing silently.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-with-statement/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-with-statement/ »&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>Explore Your Dataset With Pandas</title>
      <id>https://realpython.com/courses/explore-dataset-with-pandas/</id>
      <link href="https://realpython.com/courses/explore-dataset-with-pandas/"/>
      <updated>2021-06-01T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how to start exploring a dataset with Pandas and Python. You&#x27;ll learn how to access specific rows and columns to answer questions about your data. You&#x27;ll also see how to handle missing values and prepare to visualize your dataset in a Jupyter Notebook.</summary>
      <content type="html">
        &lt;p&gt;Do you have a large dataset that&amp;rsquo;s full of interesting insights, but you&amp;rsquo;re not sure where to start exploring it? Has your boss asked you to generate some &lt;a href=&quot;https://realpython.com/python-statistics/&quot;&gt;statistics&lt;/a&gt; from it, but they&amp;rsquo;re not so easy to extract? These are precisely the use cases where &lt;strong&gt;Pandas&lt;/strong&gt; and Python can help you! With these tools, you&amp;rsquo;ll be able to slice a large dataset down into manageable parts and glean insight from that information.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Calculate&lt;/strong&gt; metrics about your data&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Perform&lt;/strong&gt; basic queries and aggregations&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Discover&lt;/strong&gt; and handle incorrect data, inconsistencies, and missing values&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Visualize&lt;/strong&gt; your data with plots&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll also learn about the differences between the main &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structures&lt;/a&gt; that Pandas and Python use.&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>Python News: What&#x27;s New From May 2021?</title>
      <id>https://realpython.com/python-news-may-2021/</id>
      <link href="https://realpython.com/python-news-may-2021/"/>
      <updated>2021-05-31T14:00:00+00:00</updated>
      <summary>May 2021 was filled with important Python-related events. In this article, you&#x27;ll get a rundown of all the major happenings in the world of Python, including new versions of all six Pallets Projects core projects and, of course, PyCon US 2021.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you want to get up to speed on what happened in the world of &lt;strong&gt;Python&lt;/strong&gt; in &lt;strong&gt;May 2021&lt;/strong&gt;, then you’ve come to the right place to get your &lt;strong&gt;news&lt;/strong&gt;!&lt;/p&gt;
&lt;p&gt;May was a month of big events. The &lt;strong&gt;Pallets Projects&lt;/strong&gt;, home to popular frameworks like &lt;a href=&quot;https://realpython.com/tutorials/flask/&quot;&gt;Flask&lt;/a&gt; and &lt;a href=&quot;https://click.palletsprojects.com/en/8.0.x/&quot;&gt;Click&lt;/a&gt;, released new major versions of all six of its core projects. The &lt;strong&gt;Python Software Foundation (PSF)&lt;/strong&gt; hosted PyCon US 2021, a virtual conference that delivered an authentic in-person experience.&lt;/p&gt;
&lt;p&gt;Let’s dive into the biggest Python news from the past month!&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 Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/cpython-internals-sample/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-cpython-internals-sample&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from CPython Internals: Your Guide to the Python 3 Interpreter&lt;/a&gt; showing you how to unlock the inner workings of the Python language, compile the Python interpreter from source  code, and participate in the development of CPython.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;microsoft-becomes-the-third-psf-visionary-sponsor&quot;&gt;Microsoft Becomes the Third PSF Visionary Sponsor&lt;a class=&quot;headerlink&quot; href=&quot;#microsoft-becomes-the-third-psf-visionary-sponsor&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In &lt;a href=&quot;https://realpython.com/python-news-april-2021/&quot;&gt;last month’s&lt;/a&gt; news roundup, we covered how Google and Bloomberg Engineering became the first two PSF Visionary Sponsors. At the end of April, the PSF also &lt;a href=&quot;https://pyfound.blogspot.com/2021/04/welcoming-microsoft-as-visionary-sponsor.html&quot;&gt;announced&lt;/a&gt; that Microsoft increased its support to the Visionary level.&lt;/p&gt;
&lt;p&gt;Microsoft is directing its financial support to the Python &lt;a href=&quot;https://wiki.python.org/psf/PackagingWG&quot;&gt;Packaging Working Group&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;As part of our $150K financial sponsorship of the PSF, we will be focusing our funds to the Packaging Working Group to help with development costs for further improvements to PyPI and the packaging ecosystem. With recently disclosed security vulnerabilities, trusted supply chain is a critical issue for us and the Python community, and we are excited to help contribute to long-term improvements. (&lt;a href=&quot;https://devblogs.microsoft.com/python/supporting-the-python-community/#development-of-python-and-related-projects&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In addition to its Visionary sponsor status, Microsoft also has five Python core developers on staff that contribute to Python part-time: Brett Cannon, Steve Dower, Guido van Rossum, Eric Snow, and Barry Warsaw.&lt;/p&gt;
&lt;p&gt;For more information about Microsoft’s support for Python and the PSF, check out its &lt;a href=&quot;https://devblogs.microsoft.com/python/supporting-the-python-community/&quot;&gt;official announcement&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Check out Steve Dower’s &lt;a href=&quot;https://medium.com/microsoft-open-source-stories/python-at-microsoft-flying-under-the-radar-eabbdebe4fb0&quot;&gt;account&lt;/a&gt; to get an inside scoop on how Microsoft’s position toward Python has changed over the years. You can also listen to Brett Cannon share his experience with Python at Microsoft on the &lt;a href=&quot;https://realpython.com/podcasts/rpp/47/&quot;&gt;Real Python Podcast&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;pallets-releases-new-major-versions-of-all-core-projects&quot;&gt;Pallets Releases New Major Versions of All Core Projects&lt;a class=&quot;headerlink&quot; href=&quot;#pallets-releases-new-major-versions-of-all-core-projects&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Two years of hard work from the Pallets team and its many open source contributors has culminated in the release of new major versions for all six of its core projects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://flask.palletsprojects.com/en/2.0.x/changes#version-2-0-0&quot;&gt;Flask 2.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://werkzeug.palletsprojects.com/en/2.0.x/changes/#version-2-0-0&quot;&gt;Werkzeug 2.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://jinja.palletsprojects.com/en/3.0.x/changes/#version-3-0-0&quot;&gt;Jinja 3.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://click.palletsprojects.com/en/8.0.x/changes/#version-8-0&quot;&gt;Click 8.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://itsdangerous.palletsprojects.com/en/2.0.x/changes/#version-2-0-0&quot;&gt;ItsDangerous 2.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://markupsafe.palletsprojects.com/en/2.0.x/changes/#version-2-0-0&quot;&gt;MarkupSafe 2.0&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All six projects have dropped support for Python 2 and Python 3.5, making Python 3.6 the minimum supported version. Previously deprecated code has been removed, and some new deprecations have been added.&lt;/p&gt;
&lt;p&gt;Some of the major changes affecting all six projects include:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-may-2021/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-may-2021/ »&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 #62: Selecting the Ideal Data Structure &amp; Unravelling Python&#x27;s &quot;pass&quot; and &quot;with&quot;</title>
      <id>https://realpython.com/podcasts/rpp/62/</id>
      <link href="https://realpython.com/podcasts/rpp/62/"/>
      <updated>2021-05-28T12:00:00+00:00</updated>
      <summary>How do you know you&#x27;re using the correct data structure for your Python project? There are so many built into Python and even more that are importable from the collections module. This week on the show, David Amos is back, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects. We discuss a recent three-part video course on selecting the ideal data structure.</summary>
      <content type="html">
        &lt;p&gt;How do you know you&#x27;re using the correct data structure for your Python project? There are so many built into Python and even more that are importable from the collections module. This week on the show, David Amos is back, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects. We discuss a recent three-part video course on selecting the ideal data structure.&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>Visualizing Data in Python Using plt.scatter()</title>
      <id>https://realpython.com/visualizing-python-plt-scatter/</id>
      <link href="https://realpython.com/visualizing-python-plt-scatter/"/>
      <updated>2021-05-26T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to create scatter plots in Python, which are a key part of many data visualization applications. You&#x27;ll get an introduction to plt.scatter(), a versatile function in the Matplotlib module for creating scatter plots.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;An important part of working with data is being able to &lt;strong&gt;visualize&lt;/strong&gt; it. Python has several third-party modules you can use for data visualization. One of the most popular modules is &lt;strong&gt;Matplotlib&lt;/strong&gt; and its submodule &lt;strong&gt;pyplot&lt;/strong&gt;, often referred to using the alias &lt;strong&gt;&lt;code&gt;plt&lt;/code&gt;&lt;/strong&gt;. Matplotlib provides a very versatile tool called &lt;strong&gt;&lt;code&gt;plt.scatter()&lt;/code&gt;&lt;/strong&gt; that allows you to create both basic and more complex scatter plots.&lt;/p&gt;
&lt;p&gt;Below, you’ll walk through several examples that will show you how to use the function effectively.&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 a &lt;strong&gt;scatter plot&lt;/strong&gt; using &lt;strong&gt;&lt;code&gt;plt.scatter()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the required and optional &lt;strong&gt;input parameters&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Customize scatter plots for &lt;strong&gt;basic and more advanced plots&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Represent &lt;strong&gt;more than two dimensions&lt;/strong&gt; on a scatter plot&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should be familiar with the &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;fundamentals of Python programming&lt;/a&gt; and the basics of &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt; and its &lt;code&gt;ndarray&lt;/code&gt; object. You don’t need to be familiar with Matplotlib to follow this tutorial, but if you’d like to learn more about the module, then check out &lt;a href=&quot;https://realpython.com/python-matplotlib-guide/&quot;&gt;Python Plotting With Matplotlib (Guide)&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;#&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-numpy-learning-guide&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a free NumPy Resources Guide&lt;/a&gt; that points you to the best tutorials, videos, and books for improving your NumPy skills.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;creating-scatter-plots&quot;&gt;Creating Scatter Plots&lt;a class=&quot;headerlink&quot; href=&quot;#creating-scatter-plots&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Scatter_plot&quot;&gt;scatter plot&lt;/a&gt; is a visual representation of how two &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; relate to each other. You can use scatter plots to explore the relationship between two variables, for example by looking for any correlation between them.&lt;/p&gt;
&lt;p&gt;In this section of the tutorial, you’ll become familiar with creating basic scatter plots using Matplotlib. In later sections, you’ll learn how to further customize your plots to represent more complex data using more than two dimensions.&lt;/p&gt;
&lt;h3 id=&quot;getting-started-with-pltscatter&quot;&gt;Getting Started With &lt;code&gt;plt.scatter()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pltscatter&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Before you can start working with &lt;a href=&quot;https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html&quot;&gt;&lt;code&gt;plt.scatter()&lt;/code&gt;&lt;/a&gt; , you’ll need to install Matplotlib. You can do so using Python’s standard package manger, &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;, by running the following command in the console :&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 -m pip install matplotlib
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now that you have Matplotlib installed, consider the following use case. A café sells six different types of bottled orange drinks. The owner wants to understand the relationship between the price of the drinks and how many of each one he sells, so he keeps track of how many of each drink he sells every day. You can visualize this relationship as follows:&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;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;plt&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;price&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;mf&quot;&gt;2.50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.23&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;4.02&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;3.25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;5.00&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;4.40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sales_per_day&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;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;62&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;49&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scatter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sales_per_day&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&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;In this Python script, you &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;import&lt;/a&gt; the &lt;code&gt;pyplot&lt;/code&gt; submodule from Matplotlib using the alias &lt;code&gt;plt&lt;/code&gt;. This alias is generally used by convention to shorten the module and submodule names. You then create &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists&lt;/a&gt; with the price and average sales per day for each of the six orange drinks sold.&lt;/p&gt;
&lt;p&gt;Finally, you create the scatter plot by using &lt;code&gt;plt.scatter()&lt;/code&gt; with the two variables you wish to compare as input arguments. As you’re using a Python script, you also need to explicitly display the figure by using &lt;code&gt;plt.show()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When you’re using an interactive environment, such as a console or a &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter Notebook&lt;/a&gt;, you don’t need to call &lt;code&gt;plt.show()&lt;/code&gt;. In this tutorial, all the examples will be in the form of scripts and will include the call to &lt;code&gt;plt.show()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Here’s the output from this code:&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-75&quot; src=&quot;https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png&quot; width=&quot;1280&quot; height=&quot;960&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png&amp;amp;w=320&amp;amp;sig=4dd2b0c7846240b62ad5d0f304f51b1740bee0b0 320w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png&amp;amp;w=640&amp;amp;sig=c61fbbc9b2dbd51bee7c43afbcca6c608548c909 640w, https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png 1280w&quot; sizes=&quot;75vw&quot; alt=&quot;Scatter Plot Part 1&quot; data-asset=&quot;3544&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;This plot shows that, in general, the more expensive a drink is, the fewer items are sold. However, the drink that costs $4.02 is an outlier, which may show that it’s a particularly popular product. When using scatter plots in this way, close inspection can help you explore the relationship between variables. You can then carry out further analysis, whether it’s using &lt;a href=&quot;https://realpython.com/linear-regression-in-python/&quot;&gt;linear regression&lt;/a&gt; or other techniques.&lt;/p&gt;
&lt;h3 id=&quot;comparing-pltscatter-and-pltplot&quot;&gt;Comparing &lt;code&gt;plt.scatter()&lt;/code&gt; and &lt;code&gt;plt.plot()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#comparing-pltscatter-and-pltplot&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can also produce the scatter plot shown above using another function within &lt;code&gt;matplotlib.pyplot&lt;/code&gt;. Matplotlib’s &lt;a href=&quot;https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html&quot;&gt;&lt;code&gt;plt.plot()&lt;/code&gt;&lt;/a&gt; is a general-purpose plotting function that will allow you to create various different line or marker plots.&lt;/p&gt;
&lt;p&gt;You can achieve the same scatter plot as the one you obtained in the section above with the following call to &lt;code&gt;plt.plot()&lt;/code&gt;, using the same data:&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;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sales_per_day&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;o&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&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;In this case, you had to include the marker &lt;code&gt;&quot;o&quot;&lt;/code&gt; as a third argument, as otherwise &lt;code&gt;plt.plot()&lt;/code&gt; would plot a line graph. The plot you created with this code is identical to the plot you created earlier with &lt;code&gt;plt.scatter()&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/visualizing-python-plt-scatter/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/visualizing-python-plt-scatter/ »&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>How to Set Up a Django Project</title>
      <id>https://realpython.com/courses/set-up-django-project/</id>
      <link href="https://realpython.com/courses/set-up-django-project/"/>
      <updated>2021-05-25T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn the necessary steps you&#x27;ll need to take to set up a new Django project. You&#x27;ll learn the basic setup for any new Django project that needs to happen before programming the specific functionality of your project.</summary>
      <content type="html">
        &lt;p&gt;When you start building any new Django web application, there&amp;rsquo;s a basic setup you need to tackle first. This course outlines the &lt;strong&gt;necessary steps to set up a Django project&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;During this course, you&amp;rsquo;ll focus on the initial steps you&amp;rsquo;ll need to take to start a new web application. You should first have Python installed and you should know how to work with virtual environments and Python&amp;rsquo;s package manager, &lt;code&gt;pip&lt;/code&gt;. You won&amp;rsquo;t need much programming knowledge to follow along with this setup, though you&amp;rsquo;ll need to know some Python to develop your project further afterwards.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;After finishing this course, you&amp;rsquo;ll know how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up a &lt;strong&gt;virtual environment&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Install&lt;/strong&gt; Django&lt;/li&gt;
&lt;li&gt;Pin your &lt;strong&gt;project dependencies&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Set up a Django &lt;strong&gt;project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Start a Django &lt;strong&gt;app&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&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 Blog Using Django, Vue, and GraphQL</title>
      <id>https://realpython.com/python-django-blog/</id>
      <link href="https://realpython.com/python-django-blog/"/>
      <updated>2021-05-24T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build a blog from the ground up. You&#x27;ll turn your Django blog data models into a GraphQL API and consume it in a Vue application for users to read. You&#x27;ll end up with an admin site and a user-facing site you can continue to refine for your own use.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Are you a regular Django user? Do you find yourself wanting to decouple your back end and front end? Do you want to handle data persistence in the API while displaying the data in a single-page app (SPA) in the browser using a client-side framework like React or Vue? You’re in luck. This tutorial will take you through the process of building a Django blog back end and a &lt;a href=&quot;https://vuejs.org/&quot;&gt;Vue&lt;/a&gt; front end, using &lt;a href=&quot;https://graphql.org/&quot;&gt;GraphQL&lt;/a&gt; to communicate between them.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/intermediate-python-project-ideas/&quot;&gt;Projects&lt;/a&gt; are an effective way to learn and solidify concepts. This tutorial is structured as a step-by-step project so you can learn in a hands-on way and take breaks as needed.&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;Translate your &lt;strong&gt;Django models&lt;/strong&gt; into a &lt;strong&gt;GraphQL API&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Run the &lt;strong&gt;Django server&lt;/strong&gt; and a &lt;strong&gt;Vue application&lt;/strong&gt; on your computer at the same time&lt;/li&gt;
&lt;li&gt;Administer your blog posts in the &lt;strong&gt;Django admin&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Consume a GraphQL API in Vue to &lt;strong&gt;show data in the browser&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can download all the source code you’ll use to build your Django blog application by clicking 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 the Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/django-blog-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-django-blog-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to build a blog application with Django, Vue, and GraphQL in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-a-django-blog-admin-a-graphql-api-and-a-vue-front-end&quot;&gt;Demo: A Django Blog Admin, a GraphQL API, and a Vue Front End&lt;a class=&quot;headerlink&quot; href=&quot;#demo-a-django-blog-admin-a-graphql-api-and-a-vue-front-end&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Blog applications are a common starter project because they involve create, read, update, and delete (CRUD) operations. In this project, you’ll use the Django admin to do the heavy CRUD lifting and focus on providing a GraphQL API for your blog data. &lt;/p&gt;
&lt;p&gt;Here’s a demonstration of the completed project in action:&lt;/p&gt;
&lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
  &lt;iframe class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/540329665?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;p&gt;Next, you’ll make sure you have all the necessary background information and tools before diving into building your blog application.&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 create a small blogging application with some rudimentary features. Authors can write many posts. Posts can have many tags and can be either published or unpublished.&lt;/p&gt;
&lt;p&gt;You’ll build the back end of this blog in Django, complete with an admin for adding new blog content. Then you’ll expose the content data as a GraphQL API and use Vue to display that data in the browser. You’ll accomplish this in several high-level steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Set up the Django blog&lt;/li&gt;
&lt;li&gt;Create the Django blog admin&lt;/li&gt;
&lt;li&gt;Set up Graphene-Django&lt;/li&gt;
&lt;li&gt;Set up &lt;code&gt;django-cors-headers&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Set up Vue.js&lt;/li&gt;
&lt;li&gt;Set up Vue Router&lt;/li&gt;
&lt;li&gt;Create the Vue Components&lt;/li&gt;
&lt;li&gt;Fetch the data&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Each section will provide links to any necessary resources and give you a chance to pause and come back as needed.&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;You’ll be best equipped for this tutorial if you already have a solid foundation in some web application concepts. You should understand how &lt;a href=&quot;https://realpython.com/python-requests/&quot;&gt;HTTP requests and responses&lt;/a&gt; and APIs work. You can check out &lt;a href=&quot;https://realpython.com/python-api/&quot;&gt;Python &amp;amp; APIs: A Winning Combo for Reading Public Data&lt;/a&gt; to understand the details of using GraphQL APIs vs REST APIs.&lt;/p&gt;
&lt;p&gt;Because you’ll use Django to build the back end for your blog, you’ll want to be familiar with &lt;a href=&quot;https://realpython.com/django-setup/&quot;&gt;starting a Django project&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/customize-django-admin-python/&quot;&gt;customizing the Django admin&lt;/a&gt;. If you haven’t used Django much before, you might also want to try building another Django-only project first. For a good introduction, check out &lt;a href=&quot;https://realpython.com/get-started-with-django-1/&quot;&gt;Get Started with Django Part 1: Build a Portfolio App&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Because you’ll be using Vue on the front end, some experience with reactive &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt; will also help. If you’ve only used a DOM manipulation paradigm with a framework like &lt;a href=&quot;https://jquery.com/&quot;&gt;jQuery&lt;/a&gt; in the past, the &lt;a href=&quot;https://vuejs.org/v2/guide/&quot;&gt;Vue introduction&lt;/a&gt; is a good foundation.&lt;/p&gt;
&lt;p&gt;Familiarity with JSON is also important because GraphQL queries are JSON-like and return data in JSON format. You can read about &lt;a href=&quot;https://realpython.com/python-json/&quot;&gt;Working with JSON Data in Python&lt;/a&gt; for an introduction. You’ll also need to &lt;a href=&quot;https://nodejs.org/en/download/package-manager&quot;&gt;install Node.js&lt;/a&gt; to work on the front end later in this tutorial.&lt;/p&gt;
&lt;h2 id=&quot;step-1-set-up-the-django-blog&quot;&gt;Step 1: Set Up the Django Blog&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-set-up-the-django-blog&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before going too far, you’ll need a directory in which you can organize the code for your project. Start by creating one called &lt;code&gt;dvg/&lt;/code&gt;, short for Django-Vue-GraphQL:&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;mkdir dvg/
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; dvg/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You’ll also be completely splitting up the front-end and back-end code, so it’s a good idea to start creating that separation right off the bat. Create a &lt;code&gt;backend/&lt;/code&gt; directory in your project directory:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-django-blog/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-django-blog/ »&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 #61: Scaling Data Science and Machine Learning Infrastructure Like Netflix</title>
      <id>https://realpython.com/podcasts/rpp/61/</id>
      <link href="https://realpython.com/podcasts/rpp/61/"/>
      <updated>2021-05-21T12:00:00+00:00</updated>
      <summary>Would you move your data science project from a laptop to the cloud? Would you also like to have snapshots of your project saved along the way so that you can go back in time or share the state of your project with another team member? This week on the show, we have Savin Goyal from Netflix. Savin is the technical lead for machine learning infrastructure at Netflix. He joins us to talk about Metaflow, an open-source tool to simplify building, managing, and scaling data science projects.</summary>
      <content type="html">
        &lt;p&gt;Would you move your data science project from a laptop to the cloud? Would you also like to have snapshots of your project saved along the way so that you can go back in time or share the state of your project with another team member? This week on the show, we have Savin Goyal from Netflix. Savin is the technical lead for machine learning infrastructure at Netflix. He joins us to talk about Metaflow, an open-source tool to simplify building, managing, and scaling data science 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>Build a Bulk File Rename Tool With Python and PyQt</title>
      <id>https://realpython.com/bulk-file-rename-tool-python/</id>
      <link href="https://realpython.com/bulk-file-rename-tool-python/"/>
      <updated>2021-05-19T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build a bulk file rename tool using Python and pathlib to manage the file renaming process and PyQt to provide the application&#x27;s GUI.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Say you need to rename multiple files in your personal folder using a specific naming pattern. Doing that manually can be time-consuming and error-prone. So, you’re thinking of automating the file renaming process by building your own &lt;strong&gt;bulk file rename tool&lt;/strong&gt; using Python. If so, then this tutorial is for you.&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 the GUI for a bulk file rename tool using &lt;strong&gt;Qt Designer&lt;/strong&gt; and PyQt&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;PyQt threads&lt;/strong&gt; to offload the file renaming process and prevent freezing GUIs&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;pathlib&lt;/code&gt;&lt;/strong&gt; to manage system paths and rename files&lt;/li&gt;
&lt;li&gt;Update the &lt;strong&gt;GUI state&lt;/strong&gt; according to the renaming process&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By completing the project in this tutorial, you’ll be able to apply a rich set of skills related to PyQt, Qt Designer, PyQt threads, and working with file system paths using Python’s &lt;code&gt;pathlib&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can download the final source code for the bulk file rename tool you’ll build in this tutorial by clicking 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 the Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/bulk-file-rename-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-bulk-file-rename-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to build a bulk file rename tool with Python in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-bulk-file-rename-tool-with-python-and-pyqt&quot;&gt;Demo: Bulk File Rename Tool With Python and PyQt&lt;a class=&quot;headerlink&quot; href=&quot;#demo-bulk-file-rename-tool-with-python-and-pyqt&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll build a &lt;strong&gt;bulk file rename tool&lt;/strong&gt; to automate the process of renaming multiple files in a given directory in your &lt;a href=&quot;https://en.wikipedia.org/wiki/File_system&quot;&gt;file system&lt;/a&gt;. To build this application, you’ll use Python’s &lt;code&gt;pathlib&lt;/code&gt; to manage the file renaming process and PyQt to build the application’s graphical user interface (GUI).&lt;/p&gt;
&lt;p&gt;Here’s how your bulk file rename tool will look and work once you get to the end of this tutorial:&lt;/p&gt;
&lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
  &lt;iframe class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/521010353?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;p&gt;Once you finish building the application, you’ll be able to rename multiple files in your file system, a common task when you’re organizing your personal files and folders. In this example, the application focuses on images and Python files, but you can add other file types as you go.&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;The project you’ll build in this tutorial consists of a GUI application that loads multiple files from a given directory and allows you to rename all those files in one go using a predefined filename prefix and consecutive numbers. In this section, you’ll take a first look at the problem and a possible solution. You’ll also figure out how to lay out the project.&lt;/p&gt;
&lt;h3 id=&quot;laying-out-the-project&quot;&gt;Laying Out the Project&lt;a class=&quot;headerlink&quot; href=&quot;#laying-out-the-project&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To build your bulk file rename tool, you’ll create a few &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;modules and packages&lt;/a&gt; and organize them in a coherent Python &lt;a href=&quot;https://realpython.com/python-application-layouts/&quot;&gt;application layout&lt;/a&gt;. Your project’s root directory 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;./rprename_project/
│
├── rprename/
│   │
│   ├── ui/
│   │   ├── __init__.py
│   │   ├── window.py
│   │   └── window.ui
│   │
│   ├── __init__.py
│   ├── app.py
│   ├── rename.py
│   └── views.py
│
├── README.md
├── requirements.txt
└── rprenamer.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;rprename_project/&lt;/code&gt; is the project’s root directory, where you’ll create the following files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;README.md&lt;/code&gt;&lt;/strong&gt; provides a general project description and instructions on installing and running the application. Having a &lt;a href=&quot;https://dbader.org/blog/write-a-great-readme-for-your-github-project&quot;&gt;&lt;code&gt;README.md&lt;/code&gt;&lt;/a&gt; file for your project is considered a best practice in programming, especially if you’re planning to release it as an open source solution.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;requirements.txt&lt;/code&gt;&lt;/strong&gt; provides the list of external dependencies for the project.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;rprenamer.py&lt;/code&gt;&lt;/strong&gt; provides an entry-point script to run the application.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then you have the &lt;code&gt;rprename/&lt;/code&gt; directory that will hold a Python package with the following modules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;__init__.py&lt;/code&gt;&lt;/strong&gt; enables &lt;code&gt;rprename/&lt;/code&gt; as a Python package.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;app.py&lt;/code&gt;&lt;/strong&gt; provides the PyQt skeleton application.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;rename.py&lt;/code&gt;&lt;/strong&gt; provides the file renaming functionalities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;views.py&lt;/code&gt;&lt;/strong&gt; provides the application’s GUI and related functionalities.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;ui/&lt;/code&gt; subdirectory will provide a package to store GUI-related code. It’ll contain the following files and modules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;__init__.py&lt;/code&gt;&lt;/strong&gt; enables &lt;code&gt;ui/&lt;/code&gt; as a Python package.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;window.py&lt;/code&gt;&lt;/strong&gt; contains the Python code for the application’s main window. You’ll see how to generate this file using &lt;a href=&quot;https://www.riverbankcomputing.com/static/Docs/PyQt5/designer.html#pyuic5&quot;&gt;&lt;code&gt;pyuic5&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;window.ui&lt;/code&gt;&lt;/strong&gt; holds a Qt Designer file that contains the code for the application’s main window in &lt;code&gt;XML&lt;/code&gt; format.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Go ahead and create this directory structure with all the files and modules except for &lt;code&gt;window.ui&lt;/code&gt; and &lt;code&gt;window.py&lt;/code&gt;. You’ll see how to create these two files with &lt;a href=&quot;https://realpython.com/qt-designer-python/&quot;&gt;Qt Designer&lt;/a&gt; and &lt;code&gt;pyuic5&lt;/code&gt; later in this tutorial.&lt;/p&gt;
&lt;p&gt;To download the project’s directory structure, 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 the Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/bulk-file-rename-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-bulk-file-rename-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to build a bulk file rename tool with Python in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/bulk-file-rename-tool-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/bulk-file-rename-tool-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>Using the Python or Operator</title>
      <id>https://realpython.com/courses/using-python-or-operator/</id>
      <link href="https://realpython.com/courses/using-python-or-operator/"/>
      <updated>2021-05-18T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn about how the Python or operator works and how to use it. You&#x27;ll get to know its special features and see what kind of programming problems you can solve by using or in Python.</summary>
      <content type="html">
        &lt;p&gt;There are three Boolean operators in Python: &lt;code&gt;and&lt;/code&gt;, &lt;code&gt;or&lt;/code&gt;, and &lt;code&gt;not&lt;/code&gt;. With them, you can test conditions and decide which execution path your programs will take. In this tutorial, you&amp;rsquo;ll take a deep dive into the Python &lt;code&gt;or&lt;/code&gt; operator and how to use it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll have learned:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How the Python &lt;code&gt;or&lt;/code&gt; operator works&lt;/li&gt;
&lt;li&gt;How to use the Python &lt;code&gt;or&lt;/code&gt; operator in Boolean and non-Boolean contexts&lt;/li&gt;
&lt;li&gt;What kind of programming problems you can solve by using &lt;code&gt;or&lt;/code&gt; in Python&lt;/li&gt;
&lt;li&gt;How to read and better understand other people&amp;rsquo;s code when they use some of the special features of the Python &lt;code&gt;or&lt;/code&gt; operator&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll learn how to use the Python &lt;code&gt;or&lt;/code&gt; operator by building some practical examples. Even if you don&amp;rsquo;t really use all the possibilities that the Python &lt;code&gt;or&lt;/code&gt; operator offers, mastering it will allow you to write better 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>Embedded Python: Build a Game on the BBC micro:bit</title>
      <id>https://realpython.com/embedded-python/</id>
      <link href="https://realpython.com/embedded-python/"/>
      <updated>2021-05-17T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about embedded development, an exciting area of programming that allows you to bring your code into the physical world. You&#x27;ll learn about your options for writing embedded Python code and build a basic game using the BBC micro:bit.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Writing code that runs in the terminal or in your web browser is good fun. Writing code that affects the real world, however, can be satisfying on a whole other level. Writing this sort of code is called &lt;strong&gt;embedded development&lt;/strong&gt;, and Python is making it more accessible than ever!&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;What &lt;strong&gt;embedded development&lt;/strong&gt; is and why you would use Python to do it&lt;/li&gt;
&lt;li&gt;What your &lt;strong&gt;hardware&lt;/strong&gt; and &lt;strong&gt;software&lt;/strong&gt; options are for running Python on an embedded system&lt;/li&gt;
&lt;li&gt;When &lt;strong&gt;Python&lt;/strong&gt; is a good fit for an embedded system and when it’s not&lt;/li&gt;
&lt;li&gt;How to write a basic game on the BBC micro:bit with &lt;strong&gt;MicroPython&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial contains code snippets that allow you to build a simple game on the &lt;a href=&quot;https://microbit.org/new-microbit/&quot;&gt;BBC micro:bit&lt;/a&gt;. To access the full code and get a sneak preview on what you’ll be building, 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 Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/embedded-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-embedded-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the sample code you’ll use&lt;/a&gt; to learn about embedded development with Python in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;what-is-embedded-development&quot;&gt;What Is Embedded Development?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-embedded-development&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Embedded development&lt;/strong&gt; is writing code for any device that isn’t a general-purpose computer. This definition is a little bit ambiguous, so some examples might help:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;General-purpose computers&lt;/strong&gt; include laptops, desktop PCs, smartphones, and so on.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Embedded systems&lt;/strong&gt; include washing machines, digital machines, robots, and so on. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As a general rule of thumb, if you wouldn’t call something a computer, but it still has code running on it, then it’s probably an embedded system. The name comes from the idea of &lt;em&gt;embedding&lt;/em&gt; a computer into a physical system to perform some task.&lt;/p&gt;
&lt;p&gt;Embedded systems tend to be designed to do a single task, which is why we refer to regular computers as “general purpose”: they are designed to do more than one task.&lt;/p&gt;
&lt;p&gt;In the same way that you need a computer to run regular code, to run embedded code, you need some kind of hardware. These pieces of hardware are usually referred to as &lt;strong&gt;development boards&lt;/strong&gt;, and this tutorial will introduce you to a few designed to run Python.&lt;/p&gt;
&lt;h2 id=&quot;python-for-embedded-development&quot;&gt;Python for Embedded Development&lt;a class=&quot;headerlink&quot; href=&quot;#python-for-embedded-development&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One of the best things about learning Python is that it’s applicable in so many places. You can write code that runs anywhere, even on embedded systems. In this section, you’ll learn about the trade-offs that come with using Python for your embedded project and some things to be aware of when starting out.&lt;/p&gt;
&lt;h3 id=&quot;benefits-of-using-python&quot;&gt;Benefits of Using Python&lt;a class=&quot;headerlink&quot; href=&quot;#benefits-of-using-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The core benefit that Python brings when building an embedded system is development speed. Python has libraries available for most tasks, and this still mostly holds true for its embedded implementations. You can focus on building your system since many of the problems you’d encounter have been solved already.&lt;/p&gt;
&lt;p&gt;Since Python is &lt;a href=&quot;https://en.wikipedia.org/wiki/High-level_programming_language&quot;&gt;higher level&lt;/a&gt; than other common embedded languages, the code you’ll write will be more concise. This helps development speed, meaning you’ll write code faster, but it also helps keep your code understandable.&lt;/p&gt;
&lt;p&gt;Python is &lt;a href=&quot;https://realpython.com/python-memory-management/&quot;&gt;memory managed&lt;/a&gt;. C++, a common choice for embedded development, is not. In C++, you are responsible for freeing up memory when you’re done with it, something that is very easy to forget, leading to your program running out of memory. Python does this for you.&lt;/p&gt;
&lt;h3 id=&quot;disadvantages-of-using-python&quot;&gt;Disadvantages of Using Python&lt;a class=&quot;headerlink&quot; href=&quot;#disadvantages-of-using-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;While Python’s memory management is a big help, it does incur a minor speed and memory cost. The MicroPython docs have a good &lt;a href=&quot;http://docs.micropython.org/en/latest/reference/constrained.html&quot;&gt;discussion on memory issues&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Another thing to consider is that the Python &lt;strong&gt;interpreter&lt;/strong&gt; itself takes up space. With a compiled language, the size of your program depends just on your program, but Python programs need the interpreter that runs them. The Python interpreter also takes up RAM. On the micro:bit, you can’t write Bluetooth code with Python since there’s not enough room for Python and Bluetooth at the same time.&lt;/p&gt;
&lt;p&gt;Since Python is interpreted, it can never be &lt;em&gt;quite&lt;/em&gt; as fast as a compiled language. An interpreted language needs to &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;decode each instruction&lt;/a&gt; before running it, but a compiled language can just run. In practice, though, this rarely matters as Python programs still run fast enough for most use cases.&lt;/p&gt;
&lt;h3 id=&quot;things-to-watch-out-for-when-new-to-embedded-development&quot;&gt;Things to Watch Out for When New to Embedded Development&lt;a class=&quot;headerlink&quot; href=&quot;#things-to-watch-out-for-when-new-to-embedded-development&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Modern computers have lots of memory to work with. When you’re programming them, you don’t have to worry too much about the size of lists you create or loading a whole file at once. Embedded systems, however, have limited memory. You have to be careful when writing your programs not to have too many things in memory at once.&lt;/p&gt;
&lt;p&gt;Similarly, &lt;strong&gt;processor speeds&lt;/strong&gt; on embedded systems are much slower than on desktop computers. The processor speed determines how quickly your code gets executed, so running a program on an embedded computer will take longer than running it on a desktop computer. It’s more important to think about the efficiency of embedded code—you don’t want it to take forever to run!&lt;/p&gt;
&lt;p&gt;Perhaps the biggest change when programming embedded systems is power requirements. Laptops, phones and desktop computers either plug into the wall or have large batteries. Embedded systems often have tiny batteries and have to last for a really long time, sometimes even years. Every line of code that you run costs a little bit of battery life, and it all adds up.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/embedded-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/embedded-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 #60: Building a Platform Game With Arcade and Covering Python News Monthly</title>
      <id>https://realpython.com/podcasts/rpp/60/</id>
      <link href="https://realpython.com/podcasts/rpp/60/"/>
      <updated>2021-05-14T12:00:00+00:00</updated>
      <summary>Did you know the Python Software Foundation is hiring! With the recent support of three Visionary Sponsors, the PSF has been able to open positions for a developer-in-residence and a Python packaging project manager. Real Python now has a monthly Python news article. Frequent guest of the show, David Amos compiles and summarizes the biggest Python news from the past month.</summary>
      <content type="html">
        &lt;p&gt;Did you know the Python Software Foundation is hiring! With the recent support of three Visionary Sponsors, the PSF has been able to open positions for a developer-in-residence and a Python packaging project manager. Real Python now has a monthly Python news article. Frequent guest of the show, David Amos compiles and summarizes the biggest Python news from the past month.&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>Write Pythonic and Clean Code With namedtuple</title>
      <id>https://realpython.com/python-namedtuple/</id>
      <link href="https://realpython.com/python-namedtuple/"/>
      <updated>2021-05-12T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn what Python&#x27;s namedtuple is and how to use it in your code. You&#x27;ll also learn about the main differences between named tuples and other data structures, such as dictionaries, data classes, and typed named tuples.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;a href=&quot;https://docs.python.org/3/library/collections.html#module-collections&quot;&gt;&lt;code&gt;collections&lt;/code&gt;&lt;/a&gt; module provides a &lt;a href=&quot;https://en.wikipedia.org/wiki/Factory_(object-oriented_programming)&quot;&gt;factory function&lt;/a&gt; called &lt;a href=&quot;https://docs.python.org/3/library/collections.html#collections.namedtuple&quot;&gt;&lt;code&gt;namedtuple()&lt;/code&gt;&lt;/a&gt;, which is specially designed to make your code more &lt;strong&gt;Pythonic&lt;/strong&gt; when you’re working with tuples. With &lt;code&gt;namedtuple()&lt;/code&gt;, you can create &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-immutable&quot;&gt;immutable&lt;/a&gt; sequence types that allow you to access their values using descriptive field names and the &lt;strong&gt;dot notation&lt;/strong&gt; instead of unclear integer indices.&lt;/p&gt;
&lt;p&gt;If you have some experience using Python, then you know that writing Pythonic code is a core skill for Python developers. In this tutorial, you’ll level up that skill using &lt;code&gt;namedtuple&lt;/code&gt;.&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;code&gt;namedtuple&lt;/code&gt; classes using &lt;strong&gt;&lt;code&gt;namedtuple()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Identify and take advantage of &lt;strong&gt;cool features&lt;/strong&gt; of &lt;code&gt;namedtuple&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;namedtuple&lt;/code&gt; instances to write &lt;strong&gt;Pythonic code&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Decide whether to use a &lt;code&gt;namedtuple&lt;/code&gt; or a &lt;strong&gt;similar data structure&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Subclass&lt;/strong&gt; a &lt;code&gt;namedtuple&lt;/code&gt; to provide new features&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you need to have a general understanding of Python’s philosophy related to &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;writing Pythonic and readable code&lt;/a&gt;. You also need to know the basics of working with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;Tuples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;Dictionaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;Classes and object-oriented programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-data-classes/&quot;&gt;Data classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-type-checking/&quot;&gt;Type hints&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you don’t have all the required knowledge before starting this tutorial, then that’s okay! You can stop and review the above resources as needed.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-shortened&quot; data-focus=&quot;false&quot;&gt;Click here to get a Python Cheat Sheet&lt;/a&gt; and learn the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;using-namedtuple-to-write-pythonic-code&quot;&gt;Using &lt;code&gt;namedtuple&lt;/code&gt; to Write Pythonic Code&lt;a class=&quot;headerlink&quot; href=&quot;#using-namedtuple-to-write-pythonic-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python’s &lt;a href=&quot;https://docs.python.org/3/library/collections.html#collections.namedtuple&quot;&gt;&lt;code&gt;namedtuple()&lt;/code&gt;&lt;/a&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Factory_(object-oriented_programming)&quot;&gt;factory function&lt;/a&gt; available in &lt;a href=&quot;https://docs.python.org/3/library/collections.html#module-collections&quot;&gt;&lt;code&gt;collections&lt;/code&gt;&lt;/a&gt;. It allows you to create &lt;code&gt;tuple&lt;/code&gt; subclasses with &lt;strong&gt;named fields&lt;/strong&gt;. You can access the values in a given named tuple using the &lt;strong&gt;dot notation&lt;/strong&gt; and the field names, like in &lt;code&gt;obj.attr&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;namedtuple&lt;/code&gt; was created to improve code readability by providing a way to access values using descriptive field names instead of integer indices, which most of the time don’t provide any context on what the values are. This feature also makes the code cleaner and more maintainable.&lt;/p&gt;
&lt;p&gt;In contrast, using indices to values in a regular tuple can be annoying, difficult to read, and error-prone. This is especially true if the tuple has a lot of fields and is constructed far away from where you’re using it.&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; In this tutorial, you’ll find different terms used to refer to Python’s &lt;code&gt;namedtuple&lt;/code&gt;, its factory function, and its instances.&lt;/p&gt;
&lt;p&gt;To avoid confusion, here’s a summary of how each term is used throughout the tutorial:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Term&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;namedtuple()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The factory function&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;namedtuple&lt;/code&gt;, &lt;code&gt;namedtuple&lt;/code&gt; class&lt;/td&gt;
&lt;td&gt;The tuple subclass returned by &lt;code&gt;namedtuple()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;namedtuple&lt;/code&gt; instance, named tuple&lt;/td&gt;
&lt;td&gt;An instance of a specific &lt;code&gt;namedtuple&lt;/code&gt; class&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;You’ll find these terms used with their corresponding meaning throughout the tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Besides this main feature of named tuples, you’ll find out that they:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Are &lt;strong&gt;immutable&lt;/strong&gt; data structures&lt;/li&gt;
&lt;li&gt;Have a consistent &lt;a href=&quot;https://docs.python.org/3/library/functions.html#hash&quot;&gt;hash&lt;/a&gt; value&lt;/li&gt;
&lt;li&gt;Can work as &lt;strong&gt;dictionary keys&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Can be stored in &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;sets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Have a helpful &lt;a href=&quot;https://realpython.com/documenting-python-code/&quot;&gt;docstring&lt;/a&gt; based on the type and field names&lt;/li&gt;
&lt;li&gt;Provide a helpful &lt;strong&gt;string representation&lt;/strong&gt; that prints the tuple content in a &lt;code&gt;name=value&lt;/code&gt; format&lt;/li&gt;
&lt;li&gt;Support &lt;strong&gt;indexing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Provide additional methods and attributes, such as &lt;a href=&quot;https://docs.python.org/3/library/collections.html#collections.somenamedtuple._make&quot;&gt;&lt;code&gt;._make()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://docs.python.org/3/library/collections.html#collections.somenamedtuple._asdict&quot;&gt;&lt;code&gt;_asdict()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://docs.python.org/3/library/collections.html#collections.somenamedtuple._fields&quot;&gt;&lt;code&gt;._fields&lt;/code&gt;&lt;/a&gt;, and so on&lt;/li&gt;
&lt;li&gt;Are &lt;strong&gt;backward compatible&lt;/strong&gt; with regular tuples&lt;/li&gt;
&lt;li&gt;Have &lt;strong&gt;similar memory consumption&lt;/strong&gt; to regular tuples&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In general, you can use &lt;code&gt;namedtuple&lt;/code&gt; instances wherever you need a tuple-like object. Named tuples have the advantage that they provide a way to access their values using field names and the dot notation. This will make your code more Pythonic.&lt;/p&gt;
&lt;p&gt;With this brief introduction to &lt;code&gt;namedtuple&lt;/code&gt; and its general features, you can dive deeper into creating and using them in your code.&lt;/p&gt;
&lt;h2 id=&quot;creating-tuple-like-classes-with-namedtuple&quot;&gt;Creating Tuple-Like Classes With &lt;code&gt;namedtuple()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#creating-tuple-like-classes-with-namedtuple&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You use a &lt;code&gt;namedtuple()&lt;/code&gt; to create an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-immutable&quot;&gt;immutable&lt;/a&gt; and tuple-like data structure with field names. A popular example that you’ll find in tutorials about &lt;code&gt;namedtuple&lt;/code&gt; is to create a class to represent a mathematical &lt;a href=&quot;https://en.wikipedia.org/wiki/Point_(geometry)&quot;&gt;point&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Depending on the problem, you probably want to use an immutable data structure to represent a given point. Here’s how you can create a two-dimensional point using a regular tuple:&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;# Create a 2D point as a tuple&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;point&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;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&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;point&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(2, 4)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Access coordinate x&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;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Access coordinate y&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;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Try to update a coordinate value&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;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;TypeError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;&#x27;tuple&#x27; object does not support item assignment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, you create an immutable two-dimensional &lt;code&gt;point&lt;/code&gt; using a regular &lt;code&gt;tuple&lt;/code&gt;. This code works: You have a &lt;code&gt;point&lt;/code&gt; with two coordinates, and you can’t modify any of those coordinates. However, is this code readable? Can you tell up front what the &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt; indices mean? To prevent these ambiguities, you can use a &lt;code&gt;namedtuple&lt;/code&gt; like this:&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;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;collections&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namedtuple&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Create a namedtuple type, Point&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;Point&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namedtuple&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Point&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;x y&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;nb&quot;&gt;issubclass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;tuple&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Instantiate the new type&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;point&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&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;point&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Point(x=2, y=4)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Dot notation to access coordinates&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;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&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;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Indexing to access coordinates&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;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&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;point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Named tuples are immutable&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;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;AttributeError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;can&#x27;t set attribute&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now you have a &lt;code&gt;point&lt;/code&gt; with two appropriately named fields, &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt;. Your &lt;code&gt;point&lt;/code&gt; provides a user-friendly and descriptive string representation (&lt;code&gt;Point(x=2, y=4)&lt;/code&gt;) by default. It allows you to access the coordinates using the dot notation, which is convenient, readable, and explicit. You can also use indices to access the value of each coordinate.&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; It’s important to note that, while tuples and named tuples are immutable, the values they store don’t necessarily have to be immutable.&lt;/p&gt;
&lt;p&gt;It’s totally legal to create a tuple or a named tuple that holds mutable values:&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;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;collections&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namedtuple&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;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;namedtuple&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Person&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;name children&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;john&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;John Doe&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Timmy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Jimmy&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;john&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Person(name=&#x27;John Doe&#x27;, children=[&#x27;Timmy&#x27;, &#x27;Jimmy&#x27;])&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;john&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;139695902374144&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;john&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Tina&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;john&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Person(name=&#x27;John Doe&#x27;, children=[&#x27;Timmy&#x27;, &#x27;Jimmy&#x27;, &#x27;Tina&#x27;])&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;john&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;139695902374144&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;john&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;TypeError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;unhashable type: &#x27;list&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can create named tuples that contain mutable objects. You can modify the mutable objects in the underlying tuple. However, this doesn’t mean that you’re modifying the tuple itself. The tuple will continue holding the same memory references.&lt;/p&gt;
&lt;p&gt;Finally, tuples or named tuples with mutable values aren’t &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-hashable&quot;&gt;hashable&lt;/a&gt;, as you saw in the above example.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-namedtuple/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-namedtuple/ »&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>Stacks and Queues: Selecting the Ideal Data Structure</title>
      <id>https://realpython.com/courses/stacks-queues-ideal-data-structure/</id>
      <link href="https://realpython.com/courses/stacks-queues-ideal-data-structure/"/>
      <updated>2021-05-11T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn about three of Python&#x27;s data structures: stacks, queue and priority queues. You&#x27;ll look at multiple types and classes for all of these and learn which implementations are best for your specific use cases.</summary>
      <content type="html">
        &lt;p&gt;There are a variety of ways for storing and managing data in your program and the choice of the right data structure has an effect on the readability of your code, ease of writing, and performance. Python has a wide selection of built-in mechanisms that meet most of your data structure needs. This course introduces you to three types of data structures: stacks, queues, and priority queues. &lt;/p&gt;
&lt;p&gt;There are multiple types and classes for all of these data structures and this course discusses them and provides information on how to choose the right one.&lt;/p&gt;
&lt;p&gt;In this course you&amp;rsquo;ll learn about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How stacks are defined with &lt;strong&gt;Last-In/First-Out (LIFO)&lt;/strong&gt; semantics&lt;/li&gt;
&lt;li&gt;How to use the &lt;strong&gt;collections.deque&lt;/strong&gt; object &lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;concurrency&lt;/strong&gt; will affect your choice&lt;/li&gt;
&lt;li&gt;What are &lt;strong&gt;priority queues&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Which data structure methods are &lt;strong&gt;thread&lt;/strong&gt; safe&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;decide&lt;/strong&gt; between all of implementations of these data structures&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The course is the &lt;strong&gt;third&lt;/strong&gt; part of an ongoing series, exploring how to find the right Data Structure for your projects. The &lt;strong&gt;first&lt;/strong&gt; course is &lt;a href=&quot;https://realpython.com/courses/dicts-arrays-ideal-data-structure/&quot;&gt;Dictionaries and Arrays: Selecting the Ideal Data Structure&lt;/a&gt; and the &lt;strong&gt;second&lt;/strong&gt; course is &lt;a href=&quot;https://realpython.com/courses/records-sets-ideal-data-structure/&quot;&gt;Records and Sets: Selecting the Ideal Data Structure&lt;/a&gt;.&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 #59: Organizing and Restructuring DjangoCon Europe 2021</title>
      <id>https://realpython.com/podcasts/rpp/59/</id>
      <link href="https://realpython.com/podcasts/rpp/59/"/>
      <updated>2021-05-07T12:00:00+00:00</updated>
      <summary>Are you interested in learning more about Django? Would you like to meet other professionals and learn how they are using Django? DjangoCon Europe 2021 is virtual this year, and you can join in from anywhere in the world. This week on the show, we have Miguel Magalhães and David Vaz, two of the organizers of the conference.</summary>
      <content type="html">
        &lt;p&gt;Are you interested in learning more about Django? Would you like to meet other professionals and learn how they are using Django? DjangoCon Europe 2021 is virtual this year, and you can join in from anywhere in the world. This week on the show, we have Miguel Magalhães and David Vaz, two of the organizers of the conference.&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>Simplify Python GUI Development With PySimpleGUI</title>
      <id>https://realpython.com/courses/simplify-gui-dev-pysimplegui/</id>
      <link href="https://realpython.com/courses/simplify-gui-dev-pysimplegui/"/>
      <updated>2021-05-04T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how to create a cross-platform graphical user interface (GUI) using Python and PySimpleGUI. A graphical user interface is an application that has buttons, windows, and lots of other elements that the user can use to interact with your application.</summary>
      <content type="html">
        &lt;p&gt;Creating a simple graphical user interface (GUI) that works across multiple platforms can be complicated. But it doesn&amp;rsquo;t have to be that way. You can use Python and the PySimpleGUI package to create nice-looking user interfaces that you and your users will enjoy! PySimpleGUI is a new Python GUI library that has been gaining a lot of interest recently.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Install&lt;/strong&gt; the PySimpleGUI package&lt;/li&gt;
&lt;li&gt;Create basic &lt;strong&gt;user interface&lt;/strong&gt; elements with PySimpleGUI&lt;/li&gt;
&lt;li&gt;Create applications, such as a PySimpleGUI &lt;strong&gt;image viewer&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Integrate PySimpleGUI with &lt;strong&gt;Matplotlib&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;computer vision&lt;/strong&gt; in PySimpleGUI&lt;/li&gt;
&lt;li&gt;Package your PySimpleGUI application for &lt;strong&gt;Windows&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&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 #58: Podcast Rewind With Guest Highlights for 2020-2021</title>
      <id>https://realpython.com/podcasts/rpp/58/</id>
      <link href="https://realpython.com/podcasts/rpp/58/"/>
      <updated>2021-04-30T12:00:00+00:00</updated>
      <summary>This week&#x27;s show is a bit different. We are taking a well-deserved short break, but we still wanted to share an episode with you. This rewind episode highlights clips from the many interviews over the past year or so of the show.</summary>
      <content type="html">
        &lt;p&gt;This week&#x27;s show is a bit different. We are taking a well-deserved short break, but we still wanted to share an episode with you. This rewind episode highlights clips from the many interviews over the past year or so of the show.&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>Python&#x27;s map() Function: Transforming Iterables</title>
      <id>https://realpython.com/courses/map-function-transform-iterables/</id>
      <link href="https://realpython.com/courses/map-function-transform-iterables/"/>
      <updated>2021-04-27T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how Python&#x27;s map() works and how to use it effectively in your programs. You&#x27;ll also learn how to use list comprehension and generator expressions to replace map() in a Pythonic and efficient way.</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s &lt;strong&gt;&lt;a href=&quot;https://docs.python.org/3/library/functions.html#map&quot;&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; is a built-in function that allows you to process and transform all the items in an iterable without using an explicit &lt;a href=&quot;https://realpython.com/courses/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt;, a technique commonly known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Map_(higher-order_function)&quot;&gt;mapping&lt;/a&gt;. &lt;code&gt;map()&lt;/code&gt; is useful when you need to apply a &lt;strong&gt;transformation function&lt;/strong&gt; to each item in an iterable and transform them into a new iterable. &lt;code&gt;map()&lt;/code&gt; is one of the tools that support a &lt;a href=&quot;https://realpython.com/python-functional-programming/&quot;&gt;functional programming style&lt;/a&gt; in Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/strong&gt; works&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;transform&lt;/strong&gt; different types of Python iterables using &lt;code&gt;map()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;combine&lt;/strong&gt; &lt;code&gt;map()&lt;/code&gt; with other functional tools to perform more complex transformations&lt;/li&gt;
&lt;li&gt;What tools you can use to &lt;strong&gt;replace&lt;/strong&gt; &lt;code&gt;map()&lt;/code&gt; and make your code more &lt;strong&gt;Pythonic&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&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 #57: Taking the Next Step in Python Game Development</title>
      <id>https://realpython.com/podcasts/rpp/57/</id>
      <link href="https://realpython.com/podcasts/rpp/57/"/>
      <updated>2021-04-23T12:00:00+00:00</updated>
      <summary>Are you interested in creating video games but feel limited in what you can accomplish within Python? Is there a platform where you can take advantage of your Python skills and provide the benefits of a dedicated game engine? This week on the show, we have Paweł Fertyk. Paweł is a Real Python author and has been creating games as Miskatonic Studio for several years now.</summary>
      <content type="html">
        &lt;p&gt;Are you interested in creating video games but feel limited in what you can accomplish within Python? Is there a platform where you can take advantage of your Python skills and provide the benefits of a dedicated game engine? This week on the show, we have Paweł Fertyk. Paweł is a Real Python author and has been creating games as Miskatonic Studio for several years now.&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>Learn Text Classification With Python and Keras</title>
      <id>https://realpython.com/courses/text-classification-with-keras/</id>
      <link href="https://realpython.com/courses/text-classification-with-keras/"/>
      <updated>2021-04-20T14:00:00+00:00</updated>
      <summary>Learn about Python text classification with Keras. Work your way from a bag-of-words model with logistic regression to more advanced methods leading to convolutional neural networks. See why word embeddings are useful and how you can use pretrained word embeddings. Use hyperparameter optimization to squeeze more performance out of your model.</summary>
      <content type="html">
        &lt;p&gt;Imagine you could know the mood of the people on the Internet. Maybe you are not interested in its entirety, but only if people are today happy on your favorite social media platform. After this course, you&amp;rsquo;ll be equipped to do this. While doing this, you will get a grasp of current advancements of (deep) neural networks and how they can be applied to text.&lt;/p&gt;
&lt;p&gt;Reading the mood from text with machine learning is called &lt;a href=&quot;https://realpython.com/sentiment-analysis-python/&quot;&gt;sentiment analysis&lt;/a&gt;, and it is one of the prominent use cases in text classification. This falls into the very active research field of &lt;a href=&quot;https://en.wikipedia.org/wiki/Natural_language_processing&quot;&gt;natural language processing (NLP)&lt;/a&gt;.&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 #56: OrderedDict vs dict and Object Oriented Programming in Python vs Java</title>
      <id>https://realpython.com/podcasts/rpp/56/</id>
      <link href="https://realpython.com/podcasts/rpp/56/"/>
      <updated>2021-04-16T12:00:00+00:00</updated>
      <summary>Are you looking for a bit of order when working with dictionaries in Python? Are you aware that the Python dict has changed over the last several versions and now keeps items in order? Could you learn more about object-oriented programming in Python by comparing it to another language? This week on the show, David Amos is back, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Are you looking for a bit of order when working with dictionaries in Python? Are you aware that the Python dict has changed over the last several versions and now keeps items in order? Could you learn more about object-oriented programming in Python by comparing it to another language? This week on the show, David Amos is back, and he&#x27;s brought 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>Start Managing Multiple Python Versions With pyenv</title>
      <id>https://realpython.com/courses/start-with-pyenv/</id>
      <link href="https://realpython.com/courses/start-with-pyenv/"/>
      <updated>2021-04-13T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how to install multiple Python versions and switch between them with ease, including project-specific virtual environments, with pyenv.</summary>
      <content type="html">
        &lt;p&gt;Have you ever wanted to contribute to a project that supports multiple versions of Python but aren&amp;rsquo;t sure how you would easily &lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;test&lt;/a&gt; all the versions? Are you ever curious about the latest and greatest versions of Python? Maybe you&amp;rsquo;d like to try out these new features, but you don&amp;rsquo;t want to worry about messing up your &lt;a href=&quot;https://realpython.com/effective-python-environment/&quot;&gt;development environment&lt;/a&gt;. Luckily, managing multiple versions of Python doesn&amp;rsquo;t have to be confusing if you use &lt;code&gt;pyenv&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;This course will provide you with a great overview of how to maximize your time spent working on projects and minimize the time spent in headaches trying to use the right version of Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install multiple versions of Python&lt;/li&gt;
&lt;li&gt;Install the latest development version of Python&lt;/li&gt;
&lt;li&gt;Switch between the installed versions&lt;/li&gt;
&lt;li&gt;Use virtual environments with &lt;code&gt;pyenv&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Activate different Python versions and virtual environments automatically&lt;/li&gt;
&lt;/ul&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 #55: Getting Started With Refactoring Your Python Code</title>
      <id>https://realpython.com/podcasts/rpp/55/</id>
      <link href="https://realpython.com/podcasts/rpp/55/"/>
      <updated>2021-04-09T12:00:00+00:00</updated>
      <summary>Do you think it&#x27;s time to refactor your Python code? What should you think about before starting this task? This week on the show, we have Brendan Maginnis and Nick Thapen from Sourcery. Sourcery is an automated refactoring tool that integrates into your IDE and suggests improvements to your code.</summary>
      <content type="html">
        &lt;p&gt;Do you think it&#x27;s time to refactor your Python code? What should you think about before starting this task? This week on the show, we have Brendan Maginnis and Nick Thapen from Sourcery. Sourcery is an automated refactoring tool that integrates into your IDE and suggests improvements to your 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>
  

</feed>
