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

  
    <entry>
      <title>Improve Your Tests With the Python Mock Object Library</title>
      <id>https://realpython.com/courses/python-mock-object-library/</id>
      <link href="https://realpython.com/courses/python-mock-object-library/"/>
      <updated>2020-05-12T14:00:00+00:00</updated>
      <summary>In this course, you&#39;ll learn how to use the Python mock object library, unittest.mock, to create and use mock objects to improve your tests. Obstacles like complex logic and unpredictable dependencies make writing valuable tests difficult, but unittest.mock can help you overcome these obstacles.</summary>
      <content type="html">
        &lt;p&gt;When you&amp;rsquo;re writing robust code, &lt;strong&gt;tests&lt;/strong&gt; are essential for verifying that your application logic is correct, reliable, and efficient. However, the value of your tests depends on how well they demonstrate these criteria. Obstacles such as &lt;strong&gt;complex logic&lt;/strong&gt; and unpredictable &lt;strong&gt;dependencies&lt;/strong&gt; make writing valuable tests difficult. The Python mock object library, &lt;strong&gt;&lt;code&gt;unittest.mock&lt;/code&gt;&lt;/strong&gt;, can help you overcome these obstacles.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create Python mock objects using &lt;code&gt;Mock&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Assert that you&amp;rsquo;re using objects as you intended&lt;/li&gt;
&lt;li&gt;Inspect usage data stored on your Python mocks&lt;/li&gt;
&lt;li&gt;Configure certain aspects of your Python mock objects&lt;/li&gt;
&lt;li&gt;Substitute your mocks for real objects using &lt;code&gt;patch()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Avoid common problems inherent in Python mocking&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll begin by seeing what mocking is and how it will improve your tests!&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 eval(): Evaluate Expressions Dynamically</title>
      <id>https://realpython.com/python-eval-function/</id>
      <link href="https://realpython.com/python-eval-function/"/>
      <updated>2020-05-11T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#39;ll learn how Python&#39;s eval() works and how to use it effectively in your programs. Additionally, you&#39;ll learn how to minimize the security risks associated to the use of eval().</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;strong&gt;&lt;code&gt;eval()&lt;/code&gt;&lt;/strong&gt; allows you to evaluate arbitrary Python &lt;a href=&quot;https://realpython.com/python-operators-expressions/&quot;&gt;&lt;strong&gt;expressions&lt;/strong&gt;&lt;/a&gt; from a string-based or &lt;a href=&quot;https://docs.python.org/3/library/stdtypes.html#code-objects&quot;&gt;compiled-code-based&lt;/a&gt; input. This function can be handy when you’re trying to dynamically evaluate Python expressions from any input that comes as a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt; or a compiled code object.&lt;/p&gt;
&lt;p&gt;Although Python’s &lt;code&gt;eval()&lt;/code&gt; is an incredibly useful tool, the function has some important security implications that you should consider before using it. In this tutorial, you’ll learn how &lt;code&gt;eval()&lt;/code&gt; works and how to use it safely and effectively in your Python programs.&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;How Python’s &lt;strong&gt;&lt;code&gt;eval()&lt;/code&gt;&lt;/strong&gt; works&lt;/li&gt;
&lt;li&gt;How to use &lt;code&gt;eval()&lt;/code&gt; to &lt;strong&gt;dynamically evaluate&lt;/strong&gt; arbitrary string-based or compiled-code-based input&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;eval()&lt;/code&gt; can make your code insecure and how to minimize the associated &lt;strong&gt;security risks&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Additionally, you’ll learn how to use Python’s &lt;code&gt;eval()&lt;/code&gt; to code an application that interactively evaluates math expressions. With this example, you’ll apply everything you’ve learned about &lt;code&gt;eval()&lt;/code&gt; to a real-world problem. If you want to get the code for this application, then you can click on the box below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Download the sample code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-eval-project/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-eval-project&quot; data-focus=&quot;false&quot;&gt;Click here to get the code you&#39;ll use&lt;/a&gt; to learn about Python&#39;s eval() in this tutorial.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;understanding-pythons-eval&quot;&gt;Understanding Python’s &lt;code&gt;eval()&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;You can use the built-in Python &lt;a href=&quot;https://docs.python.org/3/library/functions.html#eval&quot;&gt;&lt;strong&gt;&lt;code&gt;eval()&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; to dynamically evaluate expressions from a string-based or compiled-code-based input. If you pass in a &lt;a href=&quot;https://realpython.com/courses/python-strings/&quot;&gt;string&lt;/a&gt; to &lt;code&gt;eval()&lt;/code&gt;, then the function parses it, compiles it to &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-bytecode&quot;&gt;bytecode&lt;/a&gt;, and evaluates it as a Python expression. But if you call &lt;code&gt;eval()&lt;/code&gt; with a compiled code object, then the function performs just the evaluation step, which is quite convenient if you call &lt;code&gt;eval()&lt;/code&gt; several times with the same input.&lt;/p&gt;
&lt;p&gt;The signature of Python’s &lt;code&gt;eval()&lt;/code&gt; is defined 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;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expression&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;globals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;locals&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 function takes a first argument, called &lt;code&gt;expression&lt;/code&gt;, which holds the expression that you need to evaluate. &lt;code&gt;eval()&lt;/code&gt; also takes two optional arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;globals&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;locals&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the next three sections, you’ll learn what these arguments are and how &lt;code&gt;eval()&lt;/code&gt; uses them to evaluate Python expressions on the fly.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;a href=&quot;https://docs.python.org/3/library/functions.html#exec&quot;&gt;&lt;strong&gt;&lt;code&gt;exec()&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; to dynamically execute Python code. The main difference between &lt;code&gt;eval()&lt;/code&gt; and &lt;code&gt;exec()&lt;/code&gt; is that &lt;code&gt;eval()&lt;/code&gt; can only execute or evaluate expressions, whereas &lt;code&gt;exec()&lt;/code&gt; can execute any piece of Python code.&lt;/p&gt;
&lt;/div&gt;
&lt;h3 id=&quot;the-first-argument-expression&quot;&gt;The First Argument: &lt;code&gt;expression&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The first argument to &lt;code&gt;eval()&lt;/code&gt; is called &lt;strong&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/strong&gt;. It’s a required argument that holds the &lt;strong&gt;string-based&lt;/strong&gt; or &lt;strong&gt;compiled-code-based&lt;/strong&gt; input to the function. When you call &lt;code&gt;eval()&lt;/code&gt;, the content of &lt;code&gt;expression&lt;/code&gt; is evaluated as a Python expression. Check out the following examples that use string-based input:&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;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2 ** 8&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;256&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;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1024 + 1024&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2048&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;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sum([8, 16, 32])&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;56&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;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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;x * 2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;When you call &lt;code&gt;eval()&lt;/code&gt; with a string as an argument, the function returns the value that results from evaluating the input string. By default, &lt;code&gt;eval()&lt;/code&gt; has access to global names like &lt;code&gt;x&lt;/code&gt; in the above example.&lt;/p&gt;
&lt;p&gt;To evaluate a string-based &lt;code&gt;expression&lt;/code&gt;, Python’s &lt;code&gt;eval()&lt;/code&gt; runs the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Parse&lt;/strong&gt; &lt;code&gt;expression&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compile&lt;/strong&gt; it to bytecode&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Evaluate&lt;/strong&gt; it as a Python expression&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Return&lt;/strong&gt; the result of the evaluation&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The name &lt;code&gt;expression&lt;/code&gt; for the first argument to &lt;code&gt;eval()&lt;/code&gt; highlights that the function works only with expressions and not with &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html&quot;&gt;compound statements&lt;/a&gt;. The &lt;a href=&quot;https://docs.python.org/3/&quot;&gt;Python documentation&lt;/a&gt; defines &lt;strong&gt;expression&lt;/strong&gt; as follows:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;expression&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A piece of syntax which can be evaluated to some value. In other words, an expression is an accumulation of expression elements like literals, names, attribute access, operators or function calls which all return a value. In contrast to many other languages, not all language constructs are expressions. There are also statements which cannot be used as expressions, such as &lt;code&gt;while&lt;/code&gt;. Assignments are also statements, not expressions. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-expression&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On the other hand, a Python &lt;strong&gt;statement&lt;/strong&gt; has the following definition:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;statement&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A statement is part of a suite (a “block” of code). A statement is either an expression or one of several constructs with a keyword, such as &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt; or &lt;code&gt;for&lt;/code&gt;. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-statement&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you try to pass a compound statement to &lt;code&gt;eval()&lt;/code&gt;, then you’ll get a &lt;a href=&quot;https://realpython.com/invalid-syntax-python/&quot;&gt;&lt;code&gt;SyntaxError&lt;/code&gt;&lt;/a&gt;. Take a look at the following example in which you try to execute an &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;&lt;code&gt;if&lt;/code&gt; statement&lt;/a&gt; using &lt;code&gt;eval()&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-eval-function/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-eval-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>The Real Python Podcast – Episode #8: Docker + Python for Data Science and Machine Learning</title>
      <id>https://realpython.com/podcasts/rpp/8/</id>
      <link href="https://realpython.com/podcasts/rpp/8/"/>
      <updated>2020-05-08T12:00:00+00:00</updated>
      <summary>Docker is a common tool for Python developers creating and deploying applications, but what do you need to know if you want to use Docker for data science and machine learning? What are the best practices if you want to start using containers for your scientific projects? This week Christopher&#39;s guest is Tania Allard, she is a Sr. Developer Advocate at Microsoft focusing on Machine Learning, scientific computing, research and open source. Tania has created a talk for the PyCon US 2020 which is now online. The talk is titled &quot;Docker and Python: Making them Play Nicely and Securely for Data Science and ML.&quot; Her talk draws on her expertise in the improvement of processes, reproducibility and transparency in research and data science. They discuss a variety of tools for making your containers more secure and results reproducible. 

Tania is passionate about mentoring, open-source, and its community. She is an organizer for Mentored Sprints for Diverse Beginners, and she talks about the upcoming online sprints for PyCon US 2020. Christopher and Tania also discuss her plans to start a podcast.</summary>
      <content type="html">
        &lt;p&gt;Docker is a common tool for Python developers creating and deploying applications, but what do you need to know if you want to use Docker for data science and machine learning? What are the best practices if you want to start using containers for your scientific projects? This week Christopher&#39;s guest is Tania Allard, she is a Sr. Developer Advocate at Microsoft focusing on Machine Learning, scientific computing, research and open source. Tania has created a talk for the PyCon US 2020 which is now online. The talk is titled &quot;Docker and Python: Making them Play Nicely and Securely for Data Science and ML.&quot; Her talk draws on her expertise in the improvement of processes, reproducibility and transparency in research and data science. They discuss a variety of tools for making your containers more secure and results reproducible. 

Tania is passionate about mentoring, open-source, and its community. She is an organizer for Mentored Sprints for Diverse Beginners, and she talks about the upcoming online sprints for PyCon US 2020. Christopher and Tania also discuss her plans to start a podcast.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Move a Django Model to Another App</title>
      <id>https://realpython.com/move-django-model/</id>
      <link href="https://realpython.com/move-django-model/"/>
      <updated>2020-05-06T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#39;ll learn how to move a Django model from one app to another using Django migrations. You&#39;ll explore three different techniques and learn some helpful guidelines for choosing the best approach for your situation and needs.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’ve ever thought about refactoring your Django app, then you might have found yourself needing to move a Django model around. There are several ways to move a Django model from one app to another using Django &lt;strong&gt;migrations&lt;/strong&gt;, but unfortunately none of them are straightforward.&lt;/p&gt;
&lt;p&gt;Moving models between Django apps is usually a very complicated task that involves copying data, changing constraints, and renaming objects. Because of these complications, the Django &lt;strong&gt;object-relational mapper (ORM)&lt;/strong&gt; does not provide built-in migration operations that can detect and automate the entire process. Instead, the ORM provides a set of low-level migration operations that allow Django developers to implement the process themselves in the migration framework.&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;How to &lt;strong&gt;move a Django model&lt;/strong&gt; from one app to another&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;advanced features&lt;/strong&gt; of the Django migration command line interface (CLI), such as &lt;code&gt;sqlmigrate&lt;/code&gt;, &lt;code&gt;showmigrations&lt;/code&gt;, and &lt;code&gt;sqlsequencereset&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;How to produce and inspect a &lt;strong&gt;migration plan&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to make a migration reversible and how to &lt;strong&gt;reverse migrations&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;introspection&lt;/strong&gt; is and how Django uses it in migrations&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After completing this tutorial, you’ll be able to choose the best approach for moving a Django model from one app to another based on your specific use case.&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-django-resources-learing-guide&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a free Django Learning Resources Guide (PDF)&lt;/a&gt; that shows you tips and tricks as well as common pitfalls to avoid when building Python + Django web applications.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;example-case-move-a-django-model-to-another-app&quot;&gt;Example Case: Move a Django Model to Another App&lt;/h2&gt;
&lt;p&gt;Throughout this tutorial, you’re going work on a store app. Your store is going to start with two Django apps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;catalog&lt;/code&gt;&lt;/strong&gt;: This app is for storing data on products and product categories.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;sale&lt;/code&gt;&lt;/strong&gt;: This app is for recording and tracking product sales.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After you finish setting up these two apps, you’re going to move a Django model called &lt;code&gt;Product&lt;/code&gt; to a new app called &lt;code&gt;product&lt;/code&gt;. In the process, you’ll face the following challenges:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The model being moved has foreign key relationships with other models.&lt;/li&gt;
&lt;li&gt;Other models have foreign key relationships with the model being moved.&lt;/li&gt;
&lt;li&gt;The model being moved has an index on one of the fields (besides the primary key).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These challenges are inspired by real-life refactoring processes. After you overcome them, you’ll be ready to plan a similar migration process for your specific use case.&lt;/p&gt;
&lt;h2 id=&quot;setup-prepare-your-environment&quot;&gt;Setup: Prepare Your Environment&lt;/h2&gt;
&lt;p&gt;Before you start moving things around, you need to set up the initial state of your project. This tutorial uses Django 3 running on Python 3.8, but you can use similar techniques in other versions.&lt;/p&gt;
&lt;h3 id=&quot;set-up-a-python-virtual-environment&quot;&gt;Set Up a Python Virtual Environment&lt;/h3&gt;
&lt;p&gt;First, create your virtual environment in a new directory:&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 django-move-model-experiment
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; django-move-model-experiment
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python -m venv venv
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;For step-by-step instructions on creating a virtual environment, check out &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;create-a-django-project&quot;&gt;Create a Django Project&lt;/h3&gt;
&lt;p&gt;In your terminal, activate the virtual environment and install Django:&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; &lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; venv/bin/activate
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; pip install django
&lt;span class=&quot;go&quot;&gt;Collecting django&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Collecting pytz (from django)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Collecting asgiref~=3.2 (from django)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Collecting sqlparse&amp;gt;=0.2.2 (from django)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Installing collected packages: pytz, asgiref, sqlparse, django&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Successfully installed asgiref-3.2.3 django-3.0.4 pytz-2019.3 sqlparse-0.3.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You’re now ready to create your Django project. Use &lt;code&gt;django-admin startproject&lt;/code&gt; to create a project called &lt;code&gt;django-move-model-experiment&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; django-admin startproject django-move-model-experiment
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; django-move-model-experiment
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After running this command, you’ll see that Django created new files and directories. For more about how to start a new Django project, check out &lt;a href=&quot;https://realpython.com/django-setup/&quot;&gt;Starting a Django Project&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;create-django-apps&quot;&gt;Create Django Apps&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/move-django-model/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/move-django-model/ »&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 Python print() Function: Go Beyond the Basics</title>
      <id>https://realpython.com/courses/python-print/</id>
      <link href="https://realpython.com/courses/python-print/"/>
      <updated>2020-05-05T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#39;ll learn about the print() function in Python and discover some of its lesser-known features. Avoid common mistakes, take your &quot;hello world&quot; to the next level, and know when to use a better alternative.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re like most Python users, including us, then you probably started your Python journey by learning about &lt;strong&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/strong&gt;. It helped you write your very own &lt;code&gt;Hello Horld&lt;/code&gt; one-liner. You can use it to display formatted messages onto the screen and perhaps find some bugs. But if you think that&amp;rsquo;s all there is to know about Python&amp;rsquo;s &lt;code&gt;print()&lt;/code&gt;, then you&amp;rsquo;re missing out on a lot!&lt;/p&gt;
&lt;p&gt;Keep reading to take full advantage of this underappreciated little function. This course will get you up to speed with using Python &lt;code&gt;print()&lt;/code&gt; effectively. Prepare for a deep dive as you go through the sections. You may be surprised how much &lt;code&gt;print()&lt;/code&gt; has to offer!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Avoid common mistakes with Python&amp;rsquo;s &lt;code&gt;print()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Deal with newlines, character encodings, and buffering&lt;/li&gt;
&lt;li&gt;Write text to files&lt;/li&gt;
&lt;li&gt;Mock &lt;code&gt;print()&lt;/code&gt; in unit tests&lt;/li&gt;
&lt;li&gt;Build advanced user interfaces in the terminal&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;print()&lt;/code&gt; was a major addition to Python 3, in which it replaced the old &lt;code&gt;print&lt;/code&gt; statement available in Python 2.&lt;/p&gt;
&lt;p&gt;There were a number of good reasons for that, as you&amp;rsquo;ll see shortly. Although this tutorial focuses on Python 3, it does show the old way of printing in Python for reference.&lt;/p&gt;
&lt;/div&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using Python datetime to Work With Dates and Times</title>
      <id>https://realpython.com/python-datetime/</id>
      <link href="https://realpython.com/python-datetime/"/>
      <updated>2020-05-04T14:00:00+00:00</updated>
      <summary>Have you ever wondered about working with dates and times in Python? In this tutorial, you&#39;ll learn all about the built-in Python datetime library. You&#39;ll also learn about how to manage time zones and daylight saving time, and how to do accurate arithmetic on dates and times.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Working with dates and times is one of the biggest challenges in programming. Between dealing with time zones, daylight saving time, and different written date formats, it can be tough to keep track of which days and times you’re referencing. Fortunately, the built-in Python &lt;strong&gt;&lt;code&gt;datetime&lt;/code&gt;&lt;/strong&gt; module can help you manage the complex nature of dates and times.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why programming with &lt;strong&gt;dates and times&lt;/strong&gt; is such a challenge&lt;/li&gt;
&lt;li&gt;Which functions are available in the &lt;strong&gt;Python &lt;code&gt;datetime&lt;/code&gt;&lt;/strong&gt; module&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;print or read a date and time&lt;/strong&gt; in a specific format&lt;/li&gt;
&lt;li&gt;How to do &lt;strong&gt;arithmetic&lt;/strong&gt; with dates and times&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Plus, you’re going to develop a neat application to count down the time remaining until the next PyCon US! &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-experiment&quot; data-focus=&quot;false&quot;&gt;Click here to get our free Python Cheat Sheet&lt;/a&gt; that shows you the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;Let’s get started!&lt;/p&gt;
&lt;h2 id=&quot;programming-with-dates-and-times&quot;&gt;Programming With Dates and Times&lt;/h2&gt;
&lt;p&gt;If you’ve ever worked on software that needed to keep track of times across several geographic areas, then you probably have a sense of why programming with time can be such a pain. The fundamental disconnect is that computer programs prefer events that are perfectly ordered and regular, but the way in which most humans use and refer to time is highly irregular.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you want to learn more about why time can be so complicated to deal with, then there are many great resources available on the web. Here are a few good places to start:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=-5wpm-gesOY&quot;&gt;Computerphile: The Problem With Time &amp;amp; Timezones&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=rz3D8VG_2TY&quot;&gt;Working With Time Zones: Everything You Wish You Didn’t Need to Know&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.mojotech.com/blog/the-complexity-of-time-data-programming/&quot;&gt;The Complexity of Time Data Programming&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;One great example of this irregularity is &lt;a href=&quot;https://en.wikipedia.org/wiki/Daylight_saving_time&quot;&gt;&lt;strong&gt;daylight saving time&lt;/strong&gt;&lt;/a&gt;. In the United States and Canada, clocks are set forward by one hour on the second Sunday in March and set back by one hour on the first Sunday in November. However, this has only been the case &lt;a href=&quot;https://www.nist.gov/pml/time-and-frequency-division/popular-links/daylight-saving-time-dst&quot;&gt;since 2007&lt;/a&gt;. Prior to 2007, clocks were set forward on the first Sunday in April and set back on the last Sunday in October.&lt;/p&gt;
&lt;p&gt;Things get even more complicated when you consider &lt;a href=&quot;https://en.wikipedia.org/wiki/Time_zone&quot;&gt;&lt;strong&gt;time zones&lt;/strong&gt;&lt;/a&gt;. Ideally, time zone boundaries would follow lines of longitude exactly. However, for historical and political reasons, time zone lines are rarely straight. Often, areas that are separated by large distances find themselves in the same time zone, and adjacent areas are in different time zones. There are some time zones out there with &lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/8/88/World_Time_Zones_Map.png&quot;&gt;pretty funky shapes&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;how-computers-count-time&quot;&gt;How Computers Count Time&lt;/h3&gt;
&lt;p&gt;Nearly all computers count time from an instant called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Unix_time&quot;&gt;&lt;strong&gt;Unix epoch&lt;/strong&gt;&lt;/a&gt;. This occurred on January 1, 1970, at 00:00:00 UTC. UTC stands for &lt;a href=&quot;https://en.wikipedia.org/wiki/Coordinated_Universal_Time&quot;&gt;&lt;strong&gt;Coordinated Universal Time&lt;/strong&gt;&lt;/a&gt; and refers to the time at a longitude of 0°. UTC is often also called &lt;a href=&quot;https://en.wikipedia.org/wiki/Greenwich_Mean_Time&quot;&gt;Greenwich Mean Time&lt;/a&gt;, or GMT. UTC is not adjusted for daylight saving time, so it consistently keeps twenty-four hours in every day.&lt;/p&gt;
&lt;p&gt;By definition, Unix time elapses at the same rate as UTC, so a one-second step in UTC corresponds to a one-second step in Unix time. You can usually figure out the date and time in UTC of any given instant since January 1, 1970, by counting the number of seconds since the Unix epoch, with the exception of &lt;a href=&quot;https://www.youtube.com/watch?v=Uqjg8Kk1HXo&quot;&gt;&lt;strong&gt;leap seconds&lt;/strong&gt;&lt;/a&gt;. Leap seconds are occasionally added to UTC to account for the slowing of the Earth’s rotation but are not added to Unix time.&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; There’s an interesting bug associated with Unix time. Since many older operating systems are 32-bit, they store the Unix time in a 32-bit signed integer.&lt;/p&gt;
&lt;p&gt;This means that at 03:14:07 on January 19, 2038, the integer will overflow, resulting in what’s known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Year_2038_problem&quot;&gt;Year 2038 problem&lt;/a&gt;, or Y2038. Similar to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Year_2000_problem&quot;&gt;Y2K problem&lt;/a&gt;, Y2038 will need to be corrected to avoid catastrophic consequences for critical systems.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Nearly all programming languages, including &lt;a href=&quot;https://docs.python.org/3/library/time.html&quot;&gt;Python&lt;/a&gt;, incorporate the concept of Unix time. Python’s standard library includes a module called &lt;code&gt;time&lt;/code&gt; that can print the number of seconds since the Unix epoch:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;time&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;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1579718137.550164&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In this example, you &lt;a href=&quot;https://realpython.com/lessons/import-statement/&quot;&gt;import&lt;/a&gt; the &lt;code&gt;time&lt;/code&gt; module and execute &lt;a href=&quot;https://docs.python.org/3/library/time.html#time.time&quot;&gt;&lt;code&gt;time()&lt;/code&gt;&lt;/a&gt; to print the Unix time, or number of seconds (excluding leap seconds) since the epoch.&lt;/p&gt;
&lt;p&gt;In addition to Unix time, computers need a way to convey time information to users. As you saw in the last example, Unix time is nearly impossible for a human to parse. Instead, Unix time is typically converted to UTC, which can then be converted into a local time using &lt;strong&gt;time zone offsets&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Internet Assigned Numbers Authority (IANA)&lt;/strong&gt; maintains a &lt;a href=&quot;https://www.iana.org/time-zones&quot;&gt;database&lt;/a&gt; of all of the values of time zone offsets. IANA also releases regular updates that include any changes in time zone offsets. This database is often included with your operating system, although certain applications may include an updated copy.&lt;/p&gt;
&lt;p&gt;The database contains a copy of all the designated time zones and how many hours and minutes they’re offset from UTC. So, during the winter, when daylight saving time is not in effect, the US Eastern time zone has an offset of -05:00, or negative five hours from UTC. Other regions have different offsets, which may not be integer hours. The UTC offset for Nepal, for example, is +05:45, or positive five hours and forty-five minutes from UTC.&lt;/p&gt;
&lt;h3 id=&quot;how-standard-dates-can-be-reported&quot;&gt;How Standard Dates Can Be Reported&lt;/h3&gt;
&lt;p&gt;Unix time is how computers count time, but it would be incredibly inefficient for humans to determine the time by calculating the number of seconds from an arbitrary date. Instead, we work in terms of years, months, days, and so forth. But even with these conventions in place, another layer of complexity stems from the fact that different languages and cultures have different ways of writing the date.&lt;/p&gt;
&lt;p&gt;For instance, in the United States, dates are usually written starting with the month, then the day, then the year. This means that January 31, 2020, is written as &lt;strong&gt;01-31-2020&lt;/strong&gt;. This closely matches the long-form written version of the date.&lt;/p&gt;
&lt;p&gt;However, most of Europe and many other areas write the date starting with the day, then the month, then the year. This means that January 31, 2020, is written as &lt;strong&gt;31-01-2020&lt;/strong&gt;. These differences can cause all sorts of confusion when communicating across cultures.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-datetime/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-datetime/ »&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 #7: AsyncIO + Music, Origins of Black, and Managing Python Releases</title>
      <id>https://realpython.com/podcasts/rpp/7/</id>
      <link href="https://realpython.com/podcasts/rpp/7/"/>
      <updated>2020-05-01T12:00:00+00:00</updated>
      <summary>Want to learn more about AsyncIO in Python, with an example where you can see and hear events being triggered in real-time? This week Christopher interviews Łukasz Langa. Łukasz  has created a talk for PyCon 2020 about using AsyncIO with Music. In this talk he shows live examples of coroutines, gathering, the event loop and events being triggered to create a piece of music. They talk about his role as the release manager for Python 3.8 and 3.9. He also provides background on the origins of his very popular, uncompromising code formatter, Black, and the types of problems it can solve inside of an organization.

Łukasz previously worked for Facebook, which is where he started Black. He talks about recently moving back to Poland. Łukasz discusses his current work for Edge DB, building a new generation object-relational database.</summary>
      <content type="html">
        &lt;p&gt;Want to learn more about AsyncIO in Python, with an example where you can see and hear events being triggered in real-time? This week Christopher interviews Łukasz Langa. Łukasz  has created a talk for PyCon 2020 about using AsyncIO with Music. In this talk he shows live examples of coroutines, gathering, the event loop and events being triggered to create a piece of music. They talk about his role as the release manager for Python 3.8 and 3.9. He also provides background on the origins of his very popular, uncompromising code formatter, Black, and the types of problems it can solve inside of an organization.

Łukasz previously worked for Facebook, which is where he started Black. He talks about recently moving back to Poland. Łukasz discusses his current work for Edge DB, building a new generation object-relational database.&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>Regular Expressions: Regexes in Python, Part 1</title>
      <id>https://realpython.com/regex-python/</id>
      <link href="https://realpython.com/regex-python/"/>
      <updated>2020-04-29T14:00:00+00:00</updated>
      <summary>In previous tutorials in this series, you&#39;ve seen several different ways to compare string values with direct character-by-character comparison. In this tutorial, you&#39;ll learn how to perform more complex string pattern matching using regular expressions, or regexes, in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In this tutorial, you’ll explore &lt;strong&gt;regular expressions&lt;/strong&gt;, also known as &lt;strong&gt;regexes&lt;/strong&gt;, in Python. A regex is a special sequence of characters that defines a pattern for complex string-matching functionality.&lt;/p&gt;
&lt;p&gt;Earlier in this series, in the tutorial &lt;a href=&quot;https://realpython.com/python-strings&quot;&gt;Strings and Character Data in Python&lt;/a&gt;, you learned how to define and manipulate string objects. Since then, you’ve seen some ways to determine whether two strings match each other:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You can test whether two strings are equal using the &lt;a href=&quot;https://realpython.com/python-operators-expressions/#comparison-operators&quot;&gt;equality (&lt;code&gt;==&lt;/code&gt;)&lt;/a&gt; operator.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can test whether one string is a substring of another with the &lt;a href=&quot;https://realpython.com/python-strings/#string-operators&quot;&gt;&lt;code&gt;in&lt;/code&gt;&lt;/a&gt; operator or the &lt;a href=&quot;https://realpython.com/python-strings/#built-in-string-methods&quot;&gt;built-in string methods&lt;/a&gt; &lt;code&gt;.find()&lt;/code&gt; and &lt;code&gt;.index()&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;String matching like this is a common task in programming, and you can get a lot done with string operators and built-in methods. At times, though, you may need more sophisticated pattern-matching capabilities.&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;How to access the &lt;strong&gt;&lt;code&gt;re&lt;/code&gt; module&lt;/strong&gt;, which implements regex matching in Python&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;&lt;code&gt;re.search()&lt;/code&gt;&lt;/strong&gt; to match a pattern against a string&lt;/li&gt;
&lt;li&gt;How to create complex matching pattern with regex &lt;strong&gt;metacharacters&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Fasten your seat belt! Regex syntax takes a little getting used to. But once you get comfortable with it, you’ll find regexes almost indispensable in your Python programming.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&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;&gt;Get a sample chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python&#39;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;regexes-in-python-and-their-uses&quot;&gt;Regexes in Python and Their Uses&lt;/h2&gt;
&lt;p&gt;Imagine you have a string object &lt;code&gt;s&lt;/code&gt;. Now suppose you need to write Python code to find out whether &lt;code&gt;s&lt;/code&gt; contains the substring &lt;code&gt;&#39;123&#39;&lt;/code&gt;. There are at least a couple ways to do this. You could use the &lt;code&gt;in&lt;/code&gt; operator:&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;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;foo123bar&#39;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#39;123&#39;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If you want to know not only &lt;em&gt;whether&lt;/em&gt; &lt;code&gt;&#39;123&#39;&lt;/code&gt; exists in &lt;code&gt;s&lt;/code&gt; but also &lt;em&gt;where&lt;/em&gt; it exists, then you can use &lt;code&gt;.find()&lt;/code&gt; or &lt;code&gt;.index()&lt;/code&gt;. Each of these returns the character position within &lt;code&gt;s&lt;/code&gt; where the substring resides:&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;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;foo123bar&#39;&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;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#39;123&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&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;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#39;123&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In these examples, the matching is done by a straightforward character-by-character comparison. That will get the job done in many cases. But sometimes, the problem is more complicated than that.&lt;/p&gt;
&lt;p&gt;For example, rather than searching for a fixed substring like &lt;code&gt;&#39;123&#39;&lt;/code&gt;, suppose you wanted to determine whether a string contains &lt;em&gt;any&lt;/em&gt; three consecutive decimal digit characters, as in the strings &lt;code&gt;&#39;foo123bar&#39;&lt;/code&gt;, &lt;code&gt;&#39;foo456bar&#39;&lt;/code&gt;, &lt;code&gt;&#39;234baz&#39;&lt;/code&gt;, and &lt;code&gt;&#39;qux678&#39;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Strict character comparisons won’t cut it here. This is where regexes in Python come to the rescue.&lt;/p&gt;
&lt;h3 id=&quot;a-very-brief-history-of-regular-expressions&quot;&gt;A (Very Brief) History of Regular Expressions&lt;/h3&gt;
&lt;p&gt;In 1951, mathematician Stephen Cole Kleene described the concept of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Regular_language&quot;&gt;regular language&lt;/a&gt;, a language that is recognizable by a finite automaton and formally expressible using &lt;a href=&quot;https://en.wikipedia.org/wiki/Regular_expression&quot;&gt;regular expressions&lt;/a&gt;. In the mid-1960s, computer science pioneer &lt;a href=&quot;https://en.wikipedia.org/wiki/Ken_Thompson&quot;&gt;Ken Thompson&lt;/a&gt;, one of the original designers of Unix, implemented pattern matching in the &lt;a href=&quot;https://en.wikipedia.org/wiki/QED_(text_editor)&quot;&gt;QED text editor&lt;/a&gt; using Kleene’s notation.&lt;/p&gt;
&lt;p&gt;Since then, regexes have appeared in many programming languages, editors, and other tools as a means of determining whether a string matches a specified pattern. Python, Java, and Perl all support regex functionality, as do most Unix tools and many text editors.&lt;/p&gt;
&lt;h3 id=&quot;the-re-module&quot;&gt;The &lt;code&gt;re&lt;/code&gt; Module&lt;/h3&gt;
&lt;p&gt;Regex functionality in Python resides in a module named &lt;code&gt;re&lt;/code&gt;. The &lt;code&gt;re&lt;/code&gt; module contains many useful functions and methods, most of which you’ll learn about in the next tutorial in this series.&lt;/p&gt;
&lt;p&gt;For now, you’ll focus predominantly on one function, &lt;code&gt;re.search()&lt;/code&gt;.&lt;/p&gt;
&lt;p class=&quot;h4 mt-4&quot;&gt;&lt;code&gt;re.search(&amp;lt;regex&amp;gt;, &amp;lt;string&amp;gt;)&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Scans a string for a regex match.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;re.search(&amp;lt;regex&amp;gt;, &amp;lt;string&amp;gt;)&lt;/code&gt; scans &lt;code&gt;&amp;lt;string&amp;gt;&lt;/code&gt; looking for the first location where the pattern &lt;code&gt;&amp;lt;regex&amp;gt;&lt;/code&gt; matches. If a match is found, then &lt;code&gt;re.search()&lt;/code&gt; returns a &lt;strong&gt;match object&lt;/strong&gt;. Otherwise, it returns &lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;&lt;code&gt;None&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/regex-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/regex-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>Structuring a Python Application</title>
      <id>https://realpython.com/courses/structuring-python-application/</id>
      <link href="https://realpython.com/courses/structuring-python-application/"/>
      <updated>2020-04-28T14:00:00+00:00</updated>
      <summary>This course is a reference guide to common Python application layouts and project structures for command-line applications, web applications, and more.</summary>
      <content type="html">
        &lt;p&gt;Python, though opinionated on syntax and style, is surprisingly flexible when it comes to &lt;strong&gt;structuring your applications&lt;/strong&gt;. On the one hand, this flexibility is great: it allows different use cases to use structures that are necessary for those use cases. On the other hand, though, it can be very confusing to the new developer. The Internet isn&amp;rsquo;t a lot of help either. There are as many opinions as there are Python blogs!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Walk through a dependable &lt;strong&gt;Python application layout reference guide&lt;/strong&gt; that you can refer to for most use cases&lt;/li&gt;
&lt;li&gt;See examples of common Python application structures, including &lt;strong&gt;command-line applications&lt;/strong&gt; (CLI apps), one-off &lt;strong&gt;scripts&lt;/strong&gt;, installable &lt;strong&gt;packages&lt;/strong&gt;, and web application layouts with &lt;strong&gt;popular frameworks&lt;/strong&gt; like &lt;a href=&quot;https://realpython.com/tutorials/flask/&quot;&gt;Flask&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django&lt;/a&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 Python pickle Module: How to Persist Objects in Python</title>
      <id>https://realpython.com/python-pickle-module/</id>
      <link href="https://realpython.com/python-pickle-module/"/>
      <updated>2020-04-27T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#39;ll learn how you can use the Python pickle module to convert your objects into a stream of bytes that can be saved to a disk or sent over a network. You&#39;ll also learn the security implications of using this process on objects from an untrusted source.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;As a developer, you may sometimes need to send complex object hierarchies over a network or save the internal state of your objects to a disk or database for later use. To accomplish this, you can use a process called &lt;strong&gt;serialization&lt;/strong&gt;, which is fully supported by the standard library thanks to the Python &lt;strong&gt;&lt;code&gt;pickle&lt;/code&gt;&lt;/strong&gt; module.&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 it means to &lt;strong&gt;serialize&lt;/strong&gt; and &lt;strong&gt;deserialize&lt;/strong&gt; an object&lt;/li&gt;
&lt;li&gt;Which &lt;strong&gt;modules&lt;/strong&gt; you can use to serialize objects in Python&lt;/li&gt;
&lt;li&gt;Which kinds of objects can be serialized with the Python &lt;strong&gt;&lt;code&gt;pickle&lt;/code&gt;&lt;/strong&gt; module&lt;/li&gt;
&lt;li&gt;How to use the Python &lt;code&gt;pickle&lt;/code&gt; module to serialize &lt;strong&gt;object hierarchies&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;risks&lt;/strong&gt; are when deserializing an object from an untrusted source&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let’s get pickling!&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;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;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#39;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;serialization-in-python&quot;&gt;Serialization in Python&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;serialization&lt;/strong&gt; process is a way to convert a data structure into a linear form that can be stored or transmitted over a network. &lt;/p&gt;
&lt;p&gt;In Python, serialization allows you to take a complex object structure and transform it into a stream of bytes that can be saved to a disk or sent over a network. You may also see this process referred to as &lt;strong&gt;marshalling&lt;/strong&gt;. The reverse process, which takes a stream of bytes and converts it back into a data structure, is called &lt;strong&gt;deserialization&lt;/strong&gt; or &lt;strong&gt;unmarshalling&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Serialization can be used in a lot of different situations. One of the most common uses is saving the state of a neural network after the training phase so that you can use it later without having to redo the training.&lt;/p&gt;
&lt;p&gt;Python offers three different modules in the standard library that allow you to serialize and deserialize objects:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;a href=&quot;https://docs.python.org/3/library/marshal.html&quot;&gt;&lt;code&gt;marshal&lt;/code&gt;&lt;/a&gt; module&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://docs.python.org/3/library/json.html&quot;&gt;&lt;code&gt;json&lt;/code&gt;&lt;/a&gt; module&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://docs.python.org/3/library/pickle.html&quot;&gt;&lt;code&gt;pickle&lt;/code&gt;&lt;/a&gt; module&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In addition, Python supports &lt;a href=&quot;https://www.xml.com/axml/axml.html&quot;&gt;XML&lt;/a&gt;, which you can also use to serialize objects.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;marshal&lt;/code&gt; module is the oldest of the three listed above. It exists mainly to read and write the compiled bytecode of Python modules, or the &lt;code&gt;.pyc&lt;/code&gt; files you get when the interpreter imports a Python module. So, even though you can use &lt;code&gt;marshal&lt;/code&gt; to serialize some of your objects, it’s not recommended.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;json&lt;/code&gt; module is the newest of the three. It allows you to work with standard JSON files. JSON is a very convenient and widely used format for data exchange.&lt;/p&gt;
&lt;p&gt;There are several reasons to choose the &lt;a href=&quot;https://realpython.com/lessons/serializing-json-data/&quot;&gt;JSON format&lt;/a&gt;: It’s &lt;strong&gt;human readable&lt;/strong&gt; and &lt;strong&gt;language independent&lt;/strong&gt;, and it’s lighter than XML. With the &lt;code&gt;json&lt;/code&gt; module, you can serialize and deserialize several standard Python types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/lessons/booleans/&quot;&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/dictionaries-python/&quot;&gt;&lt;code&gt;dict&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/lessons/integers/&quot;&gt;&lt;code&gt;int&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/lessons/floats/&quot;&gt;&lt;code&gt;float&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/lists-tuples-python/&quot;&gt;&lt;code&gt;list&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/python-strings/&quot;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/lists-tuples-python/&quot;&gt;&lt;code&gt;tuple&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;&lt;code&gt;None&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Python &lt;code&gt;pickle&lt;/code&gt; module is another way to serialize and deserialize objects in Python. It differs from the &lt;code&gt;json&lt;/code&gt; module in that it serializes objects in a binary format, which means the result is not human readable. However, it’s also faster and it works with many more Python types right out of the box, including your custom-defined objects.&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; From now on, you’ll see the terms &lt;strong&gt;pickling&lt;/strong&gt; and &lt;strong&gt;unpickling&lt;/strong&gt; used to refer to serializing and deserializing with the Python &lt;code&gt;pickle&lt;/code&gt; module.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;So, you have several different ways to serialize and deserialize objects in Python. But which one should you use? The short answer is that there’s no one-size-fits-all solution. It all depends on your use case.&lt;/p&gt;
&lt;p&gt;Here are three general guidelines for deciding which approach to use:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Don’t use the &lt;code&gt;marshal&lt;/code&gt; module. It’s used mainly by the interpreter, and the official documentation warns that the Python maintainers may modify the format in backward-incompatible ways.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;json&lt;/code&gt; module and XML are good choices if you need interoperability with different languages or a human-readable format.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The Python &lt;code&gt;pickle&lt;/code&gt; module is a better choice for all the remaining use cases. If you don’t need a human-readable format or a standard interoperable format, or if you need to serialize custom objects, then go with &lt;code&gt;pickle&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;inside-the-python-pickle-module&quot;&gt;Inside the Python &lt;code&gt;pickle&lt;/code&gt; Module&lt;/h2&gt;
&lt;p&gt;The Python &lt;code&gt;pickle&lt;/code&gt; module basically consists of four methods:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;pickle.dump(obj, file, protocol=None, *, fix_imports=True, buffer_callback=None)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pickle.dumps(obj, protocol=None, *, fix_imports=True, buffer_callback=None)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pickle.load(file, *, fix_imports=True, encoding=&quot;ASCII&quot;, errors=&quot;strict&quot;, buffers=None)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pickle.loads(bytes_object, *, fix_imports=True, encoding=&quot;ASCII&quot;, errors=&quot;strict&quot;, buffers=None)&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first two methods are used during the pickling process, and the other two are used during unpickling. The only difference between &lt;code&gt;dump()&lt;/code&gt; and &lt;code&gt;dumps()&lt;/code&gt; is that the first creates a file containing the serialization result, whereas the second returns a string.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-pickle-module/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-pickle-module/ »&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 #6: Python REST APIs and The Well-Grounded Python Developer</title>
      <id>https://realpython.com/podcasts/rpp/6/</id>
      <link href="https://realpython.com/podcasts/rpp/6/"/>
      <updated>2020-04-24T12:00:00+00:00</updated>
      <summary>Are you interested in building REST APIs with Flask and SQLAlchemy? This week Christopher interviews Doug Farrell about his four-part Real Python series on Python REST APIs. They discuss the various Python tools and libraries used in the series. Doug also shares his practices for continuous learning.

Doug has worked in process control, embedded systems, and has a long background in software development. He&#39;s currently a developer at ShutterFly, and discusses developing tools for his internal customers. He also teaches Python to kids at a STEM school near where he lives. Currently Doug is writing a book for Manning Publications, &quot;The Well-Grounded Python Developer&quot;. The book is currently available in an early access state.  And as always please check out all the additional resources and tools that Doug discusses, they are all gathered for you in the show notes.</summary>
      <content type="html">
        &lt;p&gt;Are you interested in building REST APIs with Flask and SQLAlchemy? This week Christopher interviews Doug Farrell about his four-part Real Python series on Python REST APIs. They discuss the various Python tools and libraries used in the series. Doug also shares his practices for continuous learning.

Doug has worked in process control, embedded systems, and has a long background in software development. He&#39;s currently a developer at ShutterFly, and discusses developing tools for his internal customers. He also teaches Python to kids at a STEM school near where he lives. Currently Doug is writing a book for Manning Publications, &quot;The Well-Grounded Python Developer&quot;. The book is currently available in an early access state.  And as always please check out all the additional resources and tools that Doug discusses, they are all gathered for you in the show notes.&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 Pandas DataFrame: Make Working With Data Delightful</title>
      <id>https://realpython.com/pandas-dataframe/</id>
      <link href="https://realpython.com/pandas-dataframe/"/>
      <updated>2020-04-22T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#39;ll get started with Pandas DataFrames, which are powerful and widely used two-dimensional data structures. You&#39;ll learn how to perform basic operations with data, handle missing values, work with time-series data, and visualize data from a Pandas DataFrame.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/reference/frame.html&quot;&gt;&lt;strong&gt;Pandas DataFrame&lt;/strong&gt;&lt;/a&gt; is a &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html&quot;&gt;structure&lt;/a&gt; that contains &lt;strong&gt;two-dimensional data&lt;/strong&gt; and its corresponding &lt;strong&gt;labels&lt;/strong&gt;. DataFrames are widely used in &lt;a href=&quot;https://realpython.com/tutorials/data-science/&quot;&gt;data science&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/tutorials/machine-learning/&quot;&gt;machine learning&lt;/a&gt;, scientific computing, and many other data-intensive fields.&lt;/p&gt;
&lt;p&gt;DataFrames are similar to SQL tables or the spreadsheets that you work with in Excel or Calc. In many cases, DataFrames are faster, easier to use, and more powerful than tables or spreadsheets because they’re an integral part of the &lt;a href=&quot;https://www.python.org/about/&quot;&gt;Python&lt;/a&gt; and &lt;a href=&quot;https://numpy.org/#&quot;&gt;NumPy&lt;/a&gt; ecosystems.&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 a &lt;strong&gt;Pandas DataFrame&lt;/strong&gt; is and how to create one&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;access, modify, add, sort, filter, and delete&lt;/strong&gt; data&lt;/li&gt;
&lt;li&gt;How to handle &lt;strong&gt;missing values&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to work with &lt;strong&gt;time-series data&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to quickly &lt;strong&gt;visualize&lt;/strong&gt; data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It’s time to get started with Pandas DataFrames!&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;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;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#39;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;introducing-the-pandas-dataframe&quot;&gt;Introducing the Pandas DataFrame&lt;/h2&gt;
&lt;p&gt;Pandas DataFrames are data structures that contain:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Data&lt;/strong&gt; organized in &lt;strong&gt;two dimensions&lt;/strong&gt;, rows and columns&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Labels&lt;/strong&gt; that correspond to the &lt;strong&gt;rows&lt;/strong&gt; and &lt;strong&gt;columns&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can start working with DataFrames by &lt;a href=&quot;https://realpython.com/courses/python-imports-101/&quot;&gt;importing&lt;/a&gt; Pandas:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that you have Pandas imported, you can work with DataFrames.&lt;/p&gt;
&lt;p&gt;Imagine you’re using Pandas to analyze data about job candidates for a position developing &lt;a href=&quot;https://realpython.com/tutorials/web-dev/&quot;&gt;web applications with Python&lt;/a&gt;. Say you’re interested in the candidates’ names, cities, ages, and scores on a Python programming test, or &lt;code&gt;py-score&lt;/code&gt;:&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;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;name&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;city&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;age&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;py-score&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;101&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Xavier&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Mexico City&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;41&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;88.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;102&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Ann&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Toronto&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;28&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;79.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;103&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Jana&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Prague&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;33&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;81.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;104&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Yi&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Shanghai&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;34&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;80.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;105&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Robin&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Manchester&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;38&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;68.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;106&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Amal&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Cairo&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;31&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;61.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;107&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Nori&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Osaka&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;37&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;84.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;In this table, the first row contains the &lt;strong&gt;column labels&lt;/strong&gt; (&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;city&lt;/code&gt;, &lt;code&gt;age&lt;/code&gt;, and &lt;code&gt;py-score&lt;/code&gt;). The first column holds the &lt;strong&gt;row labels&lt;/strong&gt; (&lt;code&gt;101&lt;/code&gt;, &lt;code&gt;102&lt;/code&gt;, and so on). All other cells are filled with the &lt;strong&gt;data values&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;Now you have everything you need to create a Pandas DataFrame.&lt;/p&gt;
&lt;p&gt;There are several ways to create a Pandas DataFrame. In most cases, you’ll use the &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html&quot;&gt;&lt;code&gt;DataFrame&lt;/code&gt; constructor&lt;/a&gt; and provide the data, labels, and other information. You can pass the data as a two-dimensional &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list, tuple,&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/numpy-array-programming/&quot;&gt;NumPy array&lt;/a&gt;. You can also pass it as a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt; or &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#series&quot;&gt;Pandas &lt;code&gt;Series&lt;/code&gt;&lt;/a&gt; instance, or as one of several other data types not covered in this tutorial.&lt;/p&gt;
&lt;p&gt;For this example, assume you’re using a &lt;a href=&quot;https://docs.python.org/3/tutorial/datastructures.html#dictionaries&quot;&gt;dictionary&lt;/a&gt; to pass the data:&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;data&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;s1&quot;&gt;&#39;name&#39;&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;s1&quot;&gt;&#39;Xavier&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Ann&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Jana&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Yi&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Robin&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Amal&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Nori&#39;&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;s1&quot;&gt;&#39;city&#39;&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;s1&quot;&gt;&#39;Mexico City&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Toronto&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Prague&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Shanghai&#39;&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;s1&quot;&gt;&#39;Manchester&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Cairo&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#39;Osaka&#39;&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;s1&quot;&gt;&#39;age&#39;&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;mi&quot;&gt;41&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;33&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;38&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;37&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;s1&quot;&gt;&#39;py-score&#39;&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;mf&quot;&gt;88.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;79.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;81.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;80.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;68.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;61.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;84.0&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;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;row_labels&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;101&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;102&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;104&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;105&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;106&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;107&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;&lt;code&gt;data&lt;/code&gt; is a &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;Python variable&lt;/a&gt; that refers to the dictionary that holds your candidate data. It also contains the labels of the columns: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&#39;name&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&#39;city&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&#39;age&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&#39;py-score&#39;&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Finally, &lt;code&gt;row_labels&lt;/code&gt; refers to a list that contains the labels of the rows, which are numbers ranging from &lt;code&gt;101&lt;/code&gt; to &lt;code&gt;107&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now you’re ready to create a Pandas DataFrame:&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;df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DataFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row_labels&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;df&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;       name         city  age  py-score&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;101  Xavier  Mexico City   41      88.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;102     Ann      Toronto   28      79.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;103    Jana       Prague   33      81.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;104      Yi     Shanghai   34      80.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;105   Robin   Manchester   38      68.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;106    Amal        Cairo   31      61.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;107    Nori        Osaka   37      84.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That’s it! &lt;code&gt;df&lt;/code&gt; is a variable that holds the reference to your Pandas DataFrame. This Pandas DataFrame looks just like the candidate table above and has the following features:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/pandas-dataframe/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/pandas-dataframe/ »&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 Coding Interviews: Tips &amp; Best Practices</title>
      <id>https://realpython.com/courses/python-coding-interviews-tips-best-practices/</id>
      <link href="https://realpython.com/courses/python-coding-interviews-tips-best-practices/"/>
      <updated>2020-04-21T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#39;ll learn how to take your Python coding interview skills to the next level and use Python&#39;s built-in functions and modules to solve problems faster and more easily.</summary>
      <content type="html">
        &lt;p&gt;You&amp;rsquo;ve made it past the phone call with the recruiter, and now it&amp;rsquo;s time to show that you know how to solve problems with actual code. Whether it&amp;rsquo;s a HackerRank exercise, a take-home assignment, or an onsite whiteboard interview, this is your moment to prove your &lt;strong&gt;coding interview&lt;/strong&gt; skills.&lt;/p&gt;
&lt;p&gt;But interviews aren&amp;rsquo;t just about solving problems: they&amp;rsquo;re also about showing that you can write &lt;strong&gt;clean production code&lt;/strong&gt;. This means that you have a deep knowledge of &lt;strong&gt;Python&amp;rsquo;s built-in functionality and libraries&lt;/strong&gt;. This knowledge shows companies that you can move quickly and won&amp;rsquo;t duplicate functionality that comes with the language just because you don&amp;rsquo;t know it exists.&lt;/p&gt;
&lt;p&gt;At &lt;em&gt;Real Python&lt;/em&gt;, we&amp;rsquo;ve put our heads together and discussed what tools we&amp;rsquo;re always impressed to see in coding interviews. This course will walk you through the best of that functionality, starting with Python built-ins, then Python&amp;rsquo;s native support for &lt;strong&gt;data structures&lt;/strong&gt;, and finally Python&amp;rsquo;s powerful (and often underappreciated) &lt;strong&gt;standard library&lt;/strong&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;Use &lt;strong&gt;&lt;code&gt;enumerate()&lt;/code&gt;&lt;/strong&gt; to iterate over both indices and values&lt;/li&gt;
&lt;li&gt;Debug problematic code with &lt;strong&gt;&lt;code&gt;breakpoint()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Format strings effectively with &lt;strong&gt;f-strings&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Sort lists with &lt;strong&gt;custom arguments&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;generators&lt;/strong&gt; instead of list comprehensions to conserve memory&lt;/li&gt;
&lt;li&gt;Define &lt;strong&gt;default values&lt;/strong&gt; when looking up dictionary keys&lt;/li&gt;
&lt;li&gt;Count hashable objects with the &lt;strong&gt;&lt;code&gt;collections.Counter&lt;/code&gt;&lt;/strong&gt; class&lt;/li&gt;
&lt;li&gt;Use the standard library to get lists of &lt;strong&gt;permutations and combinations&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>Effective Python Testing With Pytest</title>
      <id>https://realpython.com/pytest-python-testing/</id>
      <link href="https://realpython.com/pytest-python-testing/"/>
      <updated>2020-04-20T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#39;ll learn how to take your testing to the next level with pytest. You&#39;ll cover intermediate and advanced pytest features such as fixtures, marks, parameters, and plugins. With pytest, you can make your test suites fast, effective, and less painful to maintain.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;Testing your code&lt;/a&gt; brings a wide variety of benefits. It increases your confidence that the code behaves as you expect and ensures that changes to your code won’t cause regressions. Writing and maintaining tests is hard work, so you should leverage all the tools at your disposal to make it as painless as possible. &lt;a href=&quot;https://docs.pytest.org/&quot;&gt;&lt;code&gt;pytest&lt;/code&gt;&lt;/a&gt; is one of the best tools you can use to boost your testing productivity.&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;benefits&lt;/strong&gt; &lt;code&gt;pytest&lt;/code&gt; offers&lt;/li&gt;
&lt;li&gt;How to ensure your tests are &lt;strong&gt;stateless&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to make repetitious tests more &lt;strong&gt;comprehensible&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to run &lt;strong&gt;subsets&lt;/strong&gt; of tests by name or custom groups&lt;/li&gt;
&lt;li&gt;How to create and maintain &lt;strong&gt;reusable&lt;/strong&gt; testing utilities&lt;/li&gt;
&lt;/ul&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;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;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#39;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;how-to-install-pytest&quot;&gt;How to Install &lt;code&gt;pytest&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;To follow along with some of the examples in this tutorial, you’ll need to install &lt;code&gt;pytest&lt;/code&gt;. As with most Python packages, you can install &lt;code&gt;pytest&lt;/code&gt; in a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; from &lt;a href=&quot;https://realpython.com/pypi-publish-python-package/&quot;&gt;PyPI&lt;/a&gt; using &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;:&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 pytest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;pytest&lt;/code&gt; command will now be available in your installation environment.&lt;/p&gt;
&lt;h2 id=&quot;what-makes-pytest-so-useful&quot;&gt;What Makes &lt;code&gt;pytest&lt;/code&gt; So Useful?&lt;/h2&gt;
&lt;p&gt;If you’ve written unit tests for your Python code before, then you may have used Python’s built-in &lt;strong&gt;&lt;code&gt;unittest&lt;/code&gt;&lt;/strong&gt; module. &lt;code&gt;unittest&lt;/code&gt; provides a solid base on which to build your test suite, but it has a few shortcomings. &lt;/p&gt;
&lt;p&gt;A number of third-party testing frameworks attempt to address some of the issues with &lt;code&gt;unittest&lt;/code&gt;, and &lt;a href=&quot;https://realpython.com/courses/test-driven-development-pytest/&quot;&gt;&lt;code&gt;pytest&lt;/code&gt; has proven to be one of the most popular&lt;/a&gt;. &lt;code&gt;pytest&lt;/code&gt; is a feature-rich, plugin-based ecosystem for testing your Python code.&lt;/p&gt;
&lt;p&gt;If you haven’t had the pleasure of using &lt;code&gt;pytest&lt;/code&gt; yet, then you’re in for a treat! Its philosophy and features will make your testing experience more productive and enjoyable. With &lt;code&gt;pytest&lt;/code&gt;, common tasks require less code and advanced tasks can be achieved through a variety of time-saving commands and plugins. It will even run your existing tests out of the box, including those written with &lt;code&gt;unittest&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As with most frameworks, some development patterns that make sense when you first start using &lt;code&gt;pytest&lt;/code&gt; can start causing pains as your test suite grows. This tutorial will help you understand some of the tools &lt;code&gt;pytest&lt;/code&gt; provides to keep your testing efficient and effective even as it scales.&lt;/p&gt;
&lt;h3 id=&quot;less-boilerplate&quot;&gt;Less Boilerplate&lt;/h3&gt;
&lt;p&gt;Most functional tests follow the Arrange-Act-Assert model:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Arrange&lt;/strong&gt;, or set up, the conditions for the test&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Act&lt;/strong&gt; by calling some function or method&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Assert&lt;/strong&gt; that some end condition is true&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Testing frameworks typically hook into your test’s &lt;a href=&quot;https://realpython.com/lessons/assertions-and-tryexcept/&quot;&gt;assertions&lt;/a&gt; so that they can provide information when an assertion fails. &lt;code&gt;unittest&lt;/code&gt;, for example, provides a number of helpful assertion utilities out of the box. However, even a small set of tests requires a fair amount of &lt;a href=&quot;https://en.wikipedia.org/wiki/Boilerplate_code&quot;&gt;boilerplate code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Imagine you’d like to write a test suite just to make sure &lt;code&gt;unittest&lt;/code&gt; is working properly in your project. You might want to write one test that always passes and one that always fails:&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_with_unittest.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;unittest&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TestCase&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TryTesting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TestCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_always_passes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;assertTrue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_always_fails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;assertTrue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;False&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;You can then run those tests from the command line using the &lt;code&gt;discover&lt;/code&gt; option of &lt;code&gt;unittest&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python -m unittest discover
&lt;span class=&quot;go&quot;&gt;F.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;============================================================&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;FAIL: test_always_fails (test_with_unittest.TryTesting)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  File &quot;/.../test_with_unittest.py&quot;, line 9, in test_always_fails&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    self.assertTrue(False)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;AssertionError: False is not True&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Ran 2 tests in 0.001s&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;FAILED (failures=1)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As expected, one test passed and one failed. You’ve proven that &lt;code&gt;unittest&lt;/code&gt; is working, but look at what you had to do:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Import the &lt;code&gt;TestCase&lt;/code&gt; class from &lt;code&gt;unittest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;TryTesting&lt;/code&gt;, a &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;subclass&lt;/a&gt; of &lt;code&gt;TestCase&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Write a method in &lt;code&gt;TryTesting&lt;/code&gt; for each test&lt;/li&gt;
&lt;li&gt;Use one of the &lt;code&gt;self.assert*&lt;/code&gt; methods from &lt;code&gt;unittest.TestCase&lt;/code&gt; to make assertions&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That’s a significant amount of code to write, and because it’s the minimum you need for &lt;em&gt;any&lt;/em&gt; test, you’d end up writing the same code over and over. &lt;code&gt;pytest&lt;/code&gt; simplifies this workflow by allowing you to use Python’s &lt;code&gt;assert&lt;/code&gt; keyword directly:&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_with_pytest.py&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_always_passes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_always_fails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;False&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/pytest-python-testing/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/pytest-python-testing/ »&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 #5: Exploring CircuitPython</title>
      <id>https://realpython.com/podcasts/rpp/5/</id>
      <link href="https://realpython.com/podcasts/rpp/5/"/>
      <updated>2020-04-17T12:00:00+00:00</updated>
      <summary>Have you ever wanted to explore using Python with electronics? CircuitPython is a great platform to get started with. This week Christopher talks with Thea Flowers. Thea has been creating several hardware projects based around CircuitPython, and she talks about getting started on the platform. She also answers questions about how she taught herself to design and prototype printed circuit boards. 

Thea discusses several of her open source projects, including Nox, ConductHotline, and getting involved with CircuitPython. She was the conference co-chair for PyCascades, and Christopher asks her about how someone could get involved in volunteering for conferences. Thea also talks about building diversity in the community. This episode was initially recorded at an earlier date, so Christopher asked Thea to come back for a few minutes to discuss updates on her projects and about a recent honor she received.</summary>
      <content type="html">
        &lt;p&gt;Have you ever wanted to explore using Python with electronics? CircuitPython is a great platform to get started with. This week Christopher talks with Thea Flowers. Thea has been creating several hardware projects based around CircuitPython, and she talks about getting started on the platform. She also answers questions about how she taught herself to design and prototype printed circuit boards. 

Thea discusses several of her open source projects, including Nox, ConductHotline, and getting involved with CircuitPython. She was the conference co-chair for PyCascades, and Christopher asks her about how someone could get involved in volunteering for conferences. Thea also talks about building diversity in the community. This episode was initially recorded at an earlier date, so Christopher asked Thea to come back for a few minutes to discuss updates on her projects and about a recent honor she received.&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>Sorting Algorithms in Python</title>
      <id>https://realpython.com/sorting-algorithms-python/</id>
      <link href="https://realpython.com/sorting-algorithms-python/"/>
      <updated>2020-04-15T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#39;ll learn all about five different sorting algorithms in Python from both a theoretical and a practical standpoint. You&#39;ll also learn several related and important concepts, including Big O notation and recursion.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Sorting&lt;/strong&gt; is a basic building block that many other algorithms are built upon. It’s related to several exciting ideas that you’ll see throughout your programming career. Understanding how sorting algorithms in Python work behind the scenes is a fundamental step toward implementing correct and efficient algorithms that solve real-world problems.&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;How different &lt;strong&gt;sorting algorithms in Python&lt;/strong&gt; work and how they compare under different circumstances&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;Python’s built-in sort functionality&lt;/strong&gt; works behind the scenes&lt;/li&gt;
&lt;li&gt;How different computer science concepts like &lt;strong&gt;recursion&lt;/strong&gt; and &lt;strong&gt;divide and conquer&lt;/strong&gt; apply to sorting&lt;/li&gt;
&lt;li&gt;How to measure the efficiency of an algorithm using &lt;strong&gt;Big O notation&lt;/strong&gt; and &lt;strong&gt;Python’s &lt;code&gt;timeit&lt;/code&gt; module&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end of this tutorial, you’ll understand sorting algorithms from both a theoretical and a practical standpoint. More importantly, you’ll have a deeper understanding of different algorithm design techniques that you can apply to other areas of your work. Let’s get started!&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&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;&gt;Get a sample chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python&#39;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;the-importance-of-sorting-algorithms-in-python&quot;&gt;The Importance of Sorting Algorithms in Python&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.python.org/3/howto/sorting.html&quot;&gt;Sorting&lt;/a&gt; is one of the most thoroughly studied algorithms in computer science. There are dozens of different sorting implementations and applications that you can use to make your code more efficient and effective.&lt;/p&gt;
&lt;p&gt;You can use sorting to solve a wide range of problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Searching:&lt;/strong&gt; Searching for an item on a list works much faster if the list is sorted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Selection:&lt;/strong&gt; Selecting items from a list based on their relationship to the rest of the items is easier with sorted data. For example, finding the &lt;em&gt;k&lt;sup&gt;th&lt;/sup&gt;&lt;/em&gt;-largest or smallest value, or finding the median value of the list, is much easier when the values are in ascending or descending order.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Duplicates:&lt;/strong&gt; Finding duplicate values on a list can be done very quickly when the list is sorted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Distribution:&lt;/strong&gt; Analyzing the frequency distribution of items on a list is very fast if the list is sorted. For example, finding the element that appears most or least often is relatively straightforward with a sorted list.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From commercial applications to academic research and everywhere in between, there are countless ways you can use sorting to save yourself time and effort.&lt;/p&gt;
&lt;h2 id=&quot;pythons-built-in-sorting-algorithm&quot;&gt;Python’s Built-In Sorting Algorithm&lt;/h2&gt;
&lt;p&gt;The Python language, like many other high-level programming languages, offers the ability to sort data out of the box using &lt;code&gt;sorted()&lt;/code&gt;. Here’s an example of sorting an integer array:&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;array&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;8&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;6&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;mi&quot;&gt;5&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;sorted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[2, 4, 5, 6, 8]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can use &lt;code&gt;sorted()&lt;/code&gt; to sort any list as long as the values inside are comparable.&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; For a deeper dive into how Python’s built-in sorting functionality works, check out &lt;a href=&quot;https://realpython.com/python-sort/&quot;&gt;How to Use sorted() and sort() in Python&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/courses/python-sorting-data/&quot;&gt;Sorting Data With Python&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;the-significance-of-time-complexity&quot;&gt;The Significance of Time Complexity&lt;/h2&gt;
&lt;p&gt;This tutorial covers two different ways to measure the &lt;strong&gt;runtime&lt;/strong&gt; of sorting algorithms:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;For a practical point of view, you’ll measure the runtime of the implementations using the &lt;code&gt;timeit&lt;/code&gt; module.&lt;/li&gt;
&lt;li&gt;For a more theoretical perspective, you’ll measure the &lt;strong&gt;runtime complexity&lt;/strong&gt; of the algorithms using &lt;a href=&quot;https://en.wikipedia.org/wiki/Big_O_notation&quot;&gt;&lt;strong&gt;Big O notation&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;timing-your-code&quot;&gt;Timing Your Code&lt;/h3&gt;
&lt;p&gt;When comparing two sorting algorithms in Python, it’s always informative to look at how long each one takes to run. The specific time each algorithm takes will be partly determined by your hardware, but you can still use the proportional time between executions to help you decide which implementation is more time efficient. &lt;/p&gt;
&lt;p&gt;In this section, you’ll focus on a practical way to measure the actual time it takes to run to your sorting algorithms using the &lt;code&gt;timeit&lt;/code&gt; module. For more information on the different ways you can time the execution of code in Python, check out &lt;a href=&quot;https://realpython.com/python-timer/&quot;&gt;Python Timer Functions: Three Ways to Monitor Your Code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here’s a function you can use to time your algorithms:&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;lineno&quot;&gt; 1 &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;random&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;randint&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 2 &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;timeit&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repeat&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 3 &lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 4 &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run_sorting_algorithm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;algorithm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 5 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# Set up the context and prepare the call to the specified&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 6 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# algorithm using the supplied array. Only import the&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 7 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# algorithm function if it&#39;s not the built-in `sorted()`.&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 8 &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;setup_code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;from __main__ import &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{algorithm}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; \
&lt;span class=&quot;lineno&quot;&gt; 9 &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;algorithm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;sorted&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;10 &lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;11 &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;stmt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{algorithm}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{array}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;)&quot;&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;12 &lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;13 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# Execute the code ten different times and return the time&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;14 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# in seconds that each execution took&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;15 &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setup_code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stmt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repeat&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;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;16 &lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;17 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# Finally, display the name of the algorithm and the&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;18 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# minimum time it took to run&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;19 &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;Algorithm: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{algorithm}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;. Minimum execution time: {min(times)}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In this example, &lt;code&gt;run_sorting_algorithm()&lt;/code&gt; receives the name of the algorithm and the input array that needs to be sorted. Here’s a line-by-line explanation of how it works: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line 8&lt;/strong&gt; imports the name of the algorithm using the magic of &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;Python’s f-strings&lt;/a&gt;. This is so that &lt;code&gt;timeit.repeat()&lt;/code&gt; knows where to call the algorithm from. Note that this is only necessary for the custom implementations used in this tutorial. If the algorithm specified is the built-in &lt;code&gt;sorted()&lt;/code&gt;, then nothing will be imported.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line 11&lt;/strong&gt; prepares the call to the algorithm with the supplied array. This is the statement that will be executed and timed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line 15&lt;/strong&gt; calls &lt;code&gt;timeit.repeat()&lt;/code&gt; with the setup code and the statement. This will call the specified sorting algorithm ten times, returning the number of seconds each one of these executions took.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line 19&lt;/strong&gt; identifies the shortest time returned and prints it along with the name of the algorithm.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/sorting-algorithms-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/sorting-algorithms-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>Inheritance and Composition: A Python OOP Guide</title>
      <id>https://realpython.com/courses/inheritance-composition-python/</id>
      <link href="https://realpython.com/courses/inheritance-composition-python/"/>
      <updated>2020-04-14T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#39;ll learn about inheritance and composition in Python. You&#39;ll improve your object-oriented programming (OOP) skills by understanding how to use inheritance and composition and how to leverage them in their design.</summary>
      <content type="html">
        &lt;p&gt;In this course, you&amp;rsquo;ll explore &lt;strong&gt;inheritance&lt;/strong&gt; and &lt;strong&gt;composition&lt;/strong&gt; in Python. &lt;a href=&quot;https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)&quot;&gt;Inheritance&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Object_composition&quot;&gt;composition&lt;/a&gt; are two important concepts in object oriented programming that model the relationship between two classes. They are the building blocks of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object oriented design&lt;/a&gt;, and they help programmers to write reusable code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know how to&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use inheritance in Python&lt;/li&gt;
&lt;li&gt;Model class hierarchies using inheritance&lt;/li&gt;
&lt;li&gt;Use multiple inheritance in Python and understand its drawbacks&lt;/li&gt;
&lt;li&gt;Use composition to create complex objects&lt;/li&gt;
&lt;li&gt;Reuse existing code by applying composition&lt;/li&gt;
&lt;li&gt;Change application behavior at run-time through composition&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>Combining Data in Pandas With merge(), .join(), and concat()</title>
      <id>https://realpython.com/pandas-merge-join-and-concat/</id>
      <link href="https://realpython.com/pandas-merge-join-and-concat/"/>
      <updated>2020-04-13T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#39;ll learn three techniques for combining data in Pandas: merge(), .join(), and concat(). Combining Series and DataFrame objects in Pandas is a powerful way to gain new insights into your data.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Pandas’ &lt;code&gt;Series&lt;/code&gt; and &lt;code&gt;DataFrame&lt;/code&gt; objects are powerful tools for exploring and analyzing data. Part of their power comes from a multifaceted approach to combining separate datasets. With Pandas, you can &lt;strong&gt;merge&lt;/strong&gt;, &lt;strong&gt;join&lt;/strong&gt;, and &lt;strong&gt;concatenate&lt;/strong&gt; your datasets, allowing you to unify and better understand your data as you analyze it. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how and when to combine your data in Pandas with:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;merge()&lt;/code&gt;&lt;/strong&gt; for combining data on common columns or indices&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;.join()&lt;/code&gt;&lt;/strong&gt; for combining data on a key column or an index&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;concat()&lt;/code&gt;&lt;/strong&gt; for combining DataFrames across rows or columns&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you have some experience using &lt;code&gt;DataFrame&lt;/code&gt; and &lt;code&gt;Series&lt;/code&gt; objects in Pandas and you’re ready to learn how to combine them, then this tutorial will help you do exactly that. If you want a quick refresher on DataFrames before proceeding, then &lt;a href=&quot;https://realpython.com/courses/pandas-dataframes-101/&quot;&gt;Pandas DataFrames 101&lt;/a&gt; will get you caught up in no time.&lt;/p&gt;
&lt;p&gt;You can follow along with the examples in this tutorial using the interactive Jupyter Notebook and data files available at the link below: &lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Download the notebook and data set:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/pandas-merge-join-concat/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-pandas-merge-join-concat&quot; data-focus=&quot;false&quot;&gt;Click here to get the Jupyter Notebook and CSV data set you&#39;ll use&lt;/a&gt; to learn about Pandas merge(), .join(), and concat() in this tutorial.&lt;/p&gt;&lt;/div&gt;

&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The techniques you’ll learn about below will generally work for both &lt;code&gt;DataFrame&lt;/code&gt; and &lt;code&gt;Series&lt;/code&gt; objects. But for simplicity and conciseness, the examples will use the term &lt;strong&gt;dataset&lt;/strong&gt; to refer to objects that can be either DataFrames or Series.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;pandas-merge-combining-data-on-common-columns-or-indices&quot;&gt;Pandas &lt;code&gt;merge()&lt;/code&gt;: Combining Data on Common Columns or Indices&lt;/h2&gt;
&lt;p&gt;The first technique you’ll learn is &lt;code&gt;merge()&lt;/code&gt;. You can use &lt;code&gt;merge()&lt;/code&gt; any time you want to do database-like join operations. It’s the most flexible of the three operations you’ll learn.&lt;/p&gt;
&lt;p&gt;When you want to combine data objects based on one or more keys in a similar way to a relational database, &lt;code&gt;merge()&lt;/code&gt; is the tool you need. More specifically, &lt;code&gt;merge()&lt;/code&gt; is most useful when you want to combine rows that share data. &lt;/p&gt;
&lt;p&gt;You can achieve both &lt;strong&gt;many-to-one&lt;/strong&gt; and &lt;strong&gt;many-to-many&lt;/strong&gt; joins with &lt;code&gt;merge()&lt;/code&gt;. In a many-to-one join, one of your datasets will have many rows in the merge column that repeat the same values (such as 1, 1, 3, 5, 5), while the merge column in the other dataset will not have repeat values (such as 1, 3, 5).&lt;/p&gt;
&lt;p&gt;As you might have guessed, in a many-to-many join, both of your merge columns will have repeat values. These merges are more complex and result in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Cartesian_product&quot;&gt;Cartesian product&lt;/a&gt; of the joined rows. &lt;/p&gt;
&lt;p&gt;This means that, after the merge, you’ll have every combination of rows that share the same value in the key column. You’ll see this in action in the &lt;a href=&quot;#examples&quot;&gt;examples&lt;/a&gt; below.&lt;/p&gt;
&lt;p&gt;What makes &lt;code&gt;merge()&lt;/code&gt; so flexible is the sheer number of options for defining the behavior of your merge. While the list can seem daunting, with practice you’ll be able to expertly merge datasets of all kinds. &lt;/p&gt;
&lt;p&gt;When you use &lt;code&gt;merge()&lt;/code&gt;, you’ll provide two required arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;left&lt;/code&gt; DataFrame &lt;/li&gt;
&lt;li&gt;The &lt;code&gt;right&lt;/code&gt; DataFrame&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After that, you can provide a number of optional arguments to define how your datasets are merged:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;how&lt;/code&gt;&lt;/strong&gt;: This defines what kind of merge to make. It defaults to &lt;code&gt;&#39;inner&#39;&lt;/code&gt;,  but other possible options include &lt;code&gt;&#39;outer&#39;&lt;/code&gt;, &lt;code&gt;&#39;left&#39;&lt;/code&gt;, and &lt;code&gt;&#39;right&#39;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;on&lt;/code&gt;&lt;/strong&gt;: Use this to tell &lt;code&gt;merge()&lt;/code&gt; which columns or indices (also called &lt;strong&gt;key columns&lt;/strong&gt; or &lt;strong&gt;key indices&lt;/strong&gt;) you want to join on. This is optional. If it isn’t specified, and &lt;code&gt;left_index&lt;/code&gt; and &lt;code&gt;right_index&lt;/code&gt; (covered below) are &lt;code&gt;False&lt;/code&gt;, then columns from the two DataFrames that share names will be used as join keys. If you use &lt;code&gt;on&lt;/code&gt;, then the column or index you specify must be present in both objects.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;left_on&lt;/code&gt; and &lt;code&gt;right_on&lt;/code&gt;&lt;/strong&gt;: Use either of these to specify a column or index that is present only in the &lt;code&gt;left&lt;/code&gt; or &lt;code&gt;right&lt;/code&gt; objects that you are merging. Both default to &lt;code&gt;None&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;left_index&lt;/code&gt; and &lt;code&gt;right_index&lt;/code&gt;&lt;/strong&gt;: Set these to &lt;code&gt;True&lt;/code&gt; to use the index of the left or right objects to be merged. Both default to &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;suffixes&lt;/code&gt;&lt;/strong&gt;: This is a tuple of strings to append to identical column names that are not merge keys. This allows you to keep track of the origins of columns with the same name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are some of the most important parameters to pass to &lt;code&gt;merge()&lt;/code&gt;. For the full list, see the &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html#database-style-dataframe-or-named-series-joining-merging&quot;&gt;Pandas documentation&lt;/a&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; In this tutorial, you’ll see that examples always specify which column(s) to join on with &lt;code&gt;on&lt;/code&gt;. This is the safest way to merge your data because you and anyone reading your code will know exactly what to expect when &lt;code&gt;merge()&lt;/code&gt; is called. If you do not specify the merge column(s) with &lt;code&gt;on&lt;/code&gt;, then Pandas will use any columns with the same name as the merge keys. &lt;/p&gt;
&lt;/div&gt;
&lt;h3 id=&quot;how-to-merge&quot;&gt;How to &lt;code&gt;merge()&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Before getting into the details of how to use &lt;code&gt;merge()&lt;/code&gt;, you should first understand the various forms of joins: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;inner&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;&lt;code&gt;outer&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;left&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;right&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Even though you’re learning about merging, you’ll see &lt;code&gt;inner&lt;/code&gt;, &lt;code&gt;outer&lt;/code&gt;, &lt;code&gt;left&lt;/code&gt;, and &lt;code&gt;right&lt;/code&gt; also referred to as join operations. For this tutorial, you can consider these terms equivalent.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You’ll learn about these in detail below, but first take a look at this visual representation of the different joins:
&lt;figure class=&quot;figure mx-auto d-block&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/join_diagram.93e6ef63afbe.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/join_diagram.93e6ef63afbe.png&quot; width=&quot;811&quot; height=&quot;571&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/join_diagram.93e6ef63afbe.png&amp;amp;w=202&amp;amp;sig=95bee2529ed07ba897da0deeeca76ac08fe54d92 202w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/join_diagram.93e6ef63afbe.png&amp;amp;w=405&amp;amp;sig=405714f3a1c44944eed5dcfbdfed200bec9d241e 405w, https://files.realpython.com/media/join_diagram.93e6ef63afbe.png 811w&quot; sizes=&quot;75vw&quot; alt=&quot;Venn Diagram of Join Operations&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Visual Representation of Join Types&lt;/figcaption&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/pandas-merge-join-and-concat/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/pandas-merge-join-and-concat/ »&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 #4: Learning Python Through Errors</title>
      <id>https://realpython.com/podcasts/rpp/4/</id>
      <link href="https://realpython.com/podcasts/rpp/4/"/>
      <updated>2020-04-10T12:00:00+00:00</updated>
      <summary>This week Christopher interviews Martin Breuss, about a couple of the video training courses he&#39;s created for Real Python. They discuss his course on getting started with Django, and how to learn Python through errors, and how errors really are your friends.

Martin talks about his work with Coding Nomads, and teaching Python around the world. He also provides some tips on debugging and writing good questions. This episode was recorded at an earlier date, and because of recent events Martin came back to discuss a new #StayAtHome Mentorship Program he&#39;s working on. The program is meant not only for learners but also for those who want to try their hand at being a mentor. We also answer our first listener submitted question.</summary>
      <content type="html">
        &lt;p&gt;This week Christopher interviews Martin Breuss, about a couple of the video training courses he&#39;s created for Real Python. They discuss his course on getting started with Django, and how to learn Python through errors, and how errors really are your friends.

Martin talks about his work with Coding Nomads, and teaching Python around the world. He also provides some tips on debugging and writing good questions. This episode was recorded at an earlier date, and because of recent events Martin came back to discuss a new #StayAtHome Mentorship Program he&#39;s working on. The program is meant not only for learners but also for those who want to try their hand at being a mentor. We also answer our first listener submitted question.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Provide Test Fixtures for Django Models in Pytest</title>
      <id>https://realpython.com/django-pytest-fixtures/</id>
      <link href="https://realpython.com/django-pytest-fixtures/"/>
      <updated>2020-04-08T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#39;ll learn how to use fixtures to simplify your testing in pytest. If you use Django, pytest fixtures can help you write tests that are painless to update and maintain even as you make changes to your models.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’re working in Django, &lt;a href=&quot;https://pytest.org/en/latest/fixture.html&quot;&gt;&lt;code&gt;pytest&lt;/code&gt; fixtures&lt;/a&gt; can help you create tests for your models that are uncomplicated to maintain. Writing good tests is a crucial step in sustaining a successful app, and &lt;strong&gt;fixtures&lt;/strong&gt; are a key ingredient in making your test suite efficient and effective. Fixtures are little pieces of data that serve as the baseline for your tests. &lt;/p&gt;
&lt;p&gt;As your test scenarios change, it can be a pain to add, modify, and maintain your fixtures. But don’t worry. This tutorial will show you how to use &lt;a href=&quot;https://pytest-django.readthedocs.io/en/latest/&quot;&gt;the &lt;code&gt;pytest-django&lt;/code&gt; plugin&lt;/a&gt; to make writing new test cases and fixtures a breeze. &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;How to create and load &lt;strong&gt;test fixtures&lt;/strong&gt; in Django&lt;/li&gt;
&lt;li&gt;How to create and load &lt;strong&gt;&lt;code&gt;pytest&lt;/code&gt; fixtures for Django models&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;factories&lt;/strong&gt; to create test fixtures for Django models in &lt;code&gt;pytest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;How to create dependencies between test fixtures using the &lt;strong&gt;factory as fixture&lt;/strong&gt; pattern&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The concepts described in this tutorial are suited for any Python project using &lt;a href=&quot;https://docs.pytest.org/en/latest/&quot;&gt;&lt;code&gt;pytest&lt;/code&gt;&lt;/a&gt;. For convenience, the examples use the Django ORM, but the results can be reproduced in other types of ORMs and even in projects that don’t use an ORM or a database.&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-django-resources-learing-guide&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a free Django Learning Resources Guide (PDF)&lt;/a&gt; that shows you tips and tricks as well as common pitfalls to avoid when building Python + Django web applications.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;fixtures-in-django&quot;&gt;Fixtures in Django&lt;/h2&gt;
&lt;p&gt;To get started, you’re going to set up a fresh Django project. Throughout this tutorial, you’ll write some tests using the &lt;a href=&quot;https://docs.djangoproject.com/en/3.0/topics/auth/default/&quot;&gt;built-in authentication module&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-a-python-virtual-environment&quot;&gt;Setting Up a Python Virtual Environment&lt;/h3&gt;
&lt;p&gt;When you create a new project, it’s best to also create a virtual environment for it. A virtual environment allows you to isolate the project from other projects on your computer. This way, different projects can use different versions of Python, Django, or any other package without interfering with each other.&lt;/p&gt;
&lt;p&gt;Here’s how you can create your virtual environment in a new directory:&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 django_fixtures
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; django_fixtures
&lt;span class=&quot;go&quot;&gt;django_fixtures $ python -m venv venv&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;For step-by-step instructions on how to create a virtual environment, check out &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Running this command will create a new directory called &lt;code&gt;venv&lt;/code&gt;. This directory will store all the packages you install inside the virtual environment.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-a-django-project&quot;&gt;Setting Up a Django Project&lt;/h3&gt;
&lt;p&gt;Now that you have a fresh virtual environment, it’s time to set up a Django project. In your terminal, activate the virtual environment and install Django:&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; &lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; venv/bin/activate
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; pip install django
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that you have Django installed, you can create a new Django project called &lt;code&gt;django_fixtures&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; django-admin startproject django_fixtures
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After running this command, you’ll see that Django created new files and directories. For more about how to start a new Django project, check out &lt;a href=&quot;https://realpython.com/django-setup/&quot;&gt;Starting a Django Project&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To finish setting up your Django project, apply the &lt;strong&gt;migrations&lt;/strong&gt; for the built-in modules:&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; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; django_fixtures
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python manage.py migrate
&lt;span class=&quot;go&quot;&gt;Operations to perform:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Apply all migrations: admin, auth, contenttypes, sessions&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Running migrations:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying contenttypes.0001_initial... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0001_initial... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying admin.0001_initial... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying admin.0002_logentry_remove_auto_add... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying admin.0003_logentry_add_action_flag_choices... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying contenttypes.0002_remove_content_type_name... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0002_alter_permission_name_max_length... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0003_alter_user_email_max_length... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0004_alter_user_username_opts... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0005_alter_user_last_login_null... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0006_require_contenttypes_0002... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0007_alter_validators_add_error_messages... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0008_alter_user_username_max_length... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0009_alter_user_last_name_max_length... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0010_alter_group_name_max_length... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying auth.0011_update_proxy_permissions... OK&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Applying sessions.0001_initial... OK&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The output lists all the migrations Django applied. When starting a new project, Django applies migrations for built-in apps such as &lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;sessions&lt;/code&gt;, and  &lt;code&gt;admin&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now you’re ready to start writing tests and fixtures!&lt;/p&gt;
&lt;h3 id=&quot;creating-django-fixtures&quot;&gt;Creating Django Fixtures&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-pytest-fixtures/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-pytest-fixtures/ »&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>Arduino With Python: How to Get Started</title>
      <id>https://realpython.com/courses/arduino-python/</id>
      <link href="https://realpython.com/courses/arduino-python/"/>
      <updated>2020-04-07T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#39;ll discover how to use Arduino microcontrollers with Python to develop your own electronic projects. You&#39;ll learn how to set up circuits and write applications with the Firmata protocol. You&#39;ll control Arduino inputs and outputs and integrate the board with higher-level apps.</summary>
      <content type="html">
        &lt;p&gt;&lt;a href=&quot;http://www.circuitstoday.com/microcontroller-invention-history&quot;&gt;Microcontrollers&lt;/a&gt; have been around for a long time, and they&amp;rsquo;re used in everything from complex machinery to common household appliances. However, working with them has traditionally been reserved for those with formal technical training, such as technicians and electrical engineers.&lt;/p&gt;
&lt;p&gt;The emergence of &lt;strong&gt;Arduino&lt;/strong&gt; has made electronic application design much more accessible to all developers. In this course, you&amp;rsquo;ll discover how to use Arduino with Python to develop your own electronic projects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;You&amp;rsquo;ll cover the basics of Arduino with Python and learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up electronic circuits&lt;/li&gt;
&lt;li&gt;Set up the Firmata protocol on Arduino&lt;/li&gt;
&lt;li&gt;Write basic applications for Arduino in Python&lt;/li&gt;
&lt;li&gt;Control analog and digital inputs and outputs&lt;/li&gt;
&lt;li&gt;Integrate Arduino sensors and switches with higher-level apps&lt;/li&gt;
&lt;li&gt;Trigger notifications on your PC and send emails using Arduino&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 #3: Effective Python and Python at Google Scale</title>
      <id>https://realpython.com/podcasts/rpp/3/</id>
      <link href="https://realpython.com/podcasts/rpp/3/"/>
      <updated>2020-04-03T12:00:00+00:00</updated>
      <summary>In this episode, Christopher interviews Brett Slatkin about the 2nd edition of his book Effective Python. Brett talks about the revisions he made for the book, and updating it for the newest versions of Python 3. Christopher asks who is the intended developer for the book. Brett also discusses working on Google App Engine, and what it&#39;s like to develop and maintain Python applications at Google Scale. Brett mentions a brief anecdote about working with Guido van Rossum, while they both worked at Google. He also provides advice about maintaining a large and aging Python code base.</summary>
      <content type="html">
        &lt;p&gt;In this episode, Christopher interviews Brett Slatkin about the 2nd edition of his book Effective Python. Brett talks about the revisions he made for the book, and updating it for the newest versions of Python 3. Christopher asks who is the intended developer for the book. Brett also discusses working on Google App Engine, and what it&#39;s like to develop and maintain Python applications at Google Scale. Brett mentions a brief anecdote about working with Guido van Rossum, while they both worked at Google. He also provides advice about maintaining a large and aging Python code base.&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>Comparing Python Objects the Right Way: &quot;is&quot; vs &quot;==&quot;</title>
      <id>https://realpython.com/courses/python-is-identity-vs-equality/</id>
      <link href="https://realpython.com/courses/python-is-identity-vs-equality/"/>
      <updated>2020-03-31T14:00:00+00:00</updated>
      <summary>In this quick and practical course, you&#39;ll learn when to use the Python is, is not, == and != operators. You&#39;ll see what these comparison operators do under the hood, dive into some quirks of object identity and interning, and define a custom class.</summary>
      <content type="html">
        &lt;p&gt;There&amp;rsquo;s a subtle difference between the Python identity operator (&lt;code&gt;is&lt;/code&gt;) and the equality operator (&lt;code&gt;==&lt;/code&gt;). Your code can run fine when you use the Python &lt;strong&gt;&lt;code&gt;is&lt;/code&gt; operator&lt;/strong&gt; to compare numbers, until it suddenly &lt;a href=&quot;https://medium.com/peloton-engineering/the-dangers-of-using-is-in-python-f42941124027&quot;&gt;doesn&amp;rsquo;t&lt;/a&gt;. You might have heard somewhere that the Python &lt;code&gt;is&lt;/code&gt; operator is faster than the &lt;strong&gt;&lt;code&gt;==&lt;/code&gt; operator&lt;/strong&gt;, or you may feel that it looks more &lt;a href=&quot;https://realpython.com/tutorials/best-practices/&quot;&gt;Pythonic&lt;/a&gt;. However, it&amp;rsquo;s crucial to keep in mind that these operators don&amp;rsquo;t behave quite the same.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;==&lt;/code&gt; operator compares the value or &lt;strong&gt;equality&lt;/strong&gt; of two objects, whereas the Python &lt;code&gt;is&lt;/code&gt; operator checks whether two variables point to the same object in memory. In the vast majority of cases, this means you should use the equality operators &lt;code&gt;==&lt;/code&gt; and &lt;code&gt;!=&lt;/code&gt;, except when you&amp;rsquo;re comparing to &lt;code&gt;None&lt;/code&gt;. &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;What the difference is between &lt;strong&gt;object equality and identity&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;When to use equality and identity operators to &lt;strong&gt;compare objects&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What these &lt;strong&gt;Python operators&lt;/strong&gt; do under the hood&lt;/li&gt;
&lt;li&gt;Why using &lt;code&gt;is&lt;/code&gt; and &lt;code&gt;is not&lt;/code&gt; to compare values leads to &lt;strong&gt;unexpected behavior&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to write a &lt;strong&gt;custom &lt;code&gt;__eq__()&lt;/code&gt; class method&lt;/strong&gt; to define equality operator behavior&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 #2: Learn Python Skills While Creating Games</title>
      <id>https://realpython.com/podcasts/rpp/2/</id>
      <link href="https://realpython.com/podcasts/rpp/2/"/>
      <updated>2020-03-27T12:00:00+00:00</updated>
      <summary>In this episode, Christopher interviews Jon Fincher from the Real Python Team. Jon talks about his recent articles on PyGame and Arcade. They discuss if game programming is a good way to develop your Python programming skills, and if a game would make a good portfolio piece. He compares the two popular Python game libraries of Arcade and PyGame, and discusses about how to find assets for your own creations.</summary>
      <content type="html">
        &lt;p&gt;In this episode, Christopher interviews Jon Fincher from the Real Python Team. Jon talks about his recent articles on PyGame and Arcade. They discuss if game programming is a good way to develop your Python programming skills, and if a game would make a good portfolio piece. He compares the two popular Python game libraries of Arcade and PyGame, and discusses about how to find assets for your own creations.&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>Using NumPy&#39;s np.arange() Effectively</title>
      <id>https://realpython.com/courses/numpy-arange/</id>
      <link href="https://realpython.com/courses/numpy-arange/"/>
      <updated>2020-03-24T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#39;ll learn how to use the NumPy arange() function, which is one of the routines for array creation based on numerical ranges. np.arange() returns arrays with evenly spaced values</summary>
      <content type="html">
        &lt;p&gt;&lt;strong&gt;NumPy&lt;/strong&gt; is the fundamental Python library for numerical computing. Its most important type is an &lt;strong&gt;array type&lt;/strong&gt; called &lt;code&gt;ndarray&lt;/code&gt;. NumPy offers a lot of &lt;a href=&quot;https://docs.scipy.org/doc/numpy/reference/routines.array-creation.html&quot;&gt;array creation routines&lt;/a&gt; for different circumstances. &lt;strong&gt;&lt;code&gt;arange()&lt;/code&gt;&lt;/strong&gt; is one such function based on &lt;strong&gt;numerical ranges&lt;/strong&gt;. It&amp;rsquo;s often referred to as &lt;code&gt;np.arange()&lt;/code&gt; because &lt;code&gt;np&lt;/code&gt; is a widely used abbreviation for NumPy.&lt;/p&gt;
&lt;p&gt;Creating NumPy arrays is important when you&amp;rsquo;re working with other Python libraries that rely on them, like SciPy, Pandas, Matplotlib, scikit-learn, and more. NumPy is suitable for creating and working with arrays because it offers &lt;a href=&quot;https://docs.scipy.org/doc/numpy/reference/routines.html&quot;&gt;useful routines&lt;/a&gt;, enables &lt;a href=&quot;https://realpython.com/numpy-tensorflow-performance/&quot;&gt;performance boosts&lt;/a&gt;, and allows you to write &lt;a href=&quot;https://realpython.com/numpy-array-programming/&quot;&gt;concise code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;code&gt;np.arange()&lt;/code&gt; is&lt;/li&gt;
&lt;li&gt;How to use &lt;code&gt;np.arange()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;np.arange()&lt;/code&gt; compares to the Python built-in class &lt;a href=&quot;https://realpython.com/python-range/&quot;&gt;&lt;code&gt;range&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Which routines are similar to &lt;code&gt;np.arange()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&amp;rsquo;s see &lt;strong&gt;&lt;code&gt;np.arange()&lt;/code&gt;&lt;/strong&gt; in action!&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 #1: Python Decorators and Writing for Real Python</title>
      <id>https://realpython.com/podcasts/rpp/1/</id>
      <link href="https://realpython.com/podcasts/rpp/1/"/>
      <updated>2020-03-20T14:00:00+00:00</updated>
      <summary>In this first episode, Christopher interviews Geir Arne Hjelle from the Real Python Team.

You’ll learn about Geir Arne’s background as a Pythonista and PyCon speaker, the tutorials he’s written for the site, how Python decorators can help you write better code, and what Real Python’s tutorial publishing process looks like behind the scenes.</summary>
      <content type="html">
        &lt;p&gt;In this first episode, Christopher interviews Geir Arne Hjelle from the Real Python Team.

You’ll learn about Geir Arne’s background as a Pythonista and PyCon speaker, the tutorials he’s written for the site, how Python decorators can help you write better code, and what Real Python’s tutorial publishing process looks like behind the scenes.&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>Make a 2D Side-Scroller Game With PyGame</title>
      <id>https://realpython.com/courses/pygame-primer/</id>
      <link href="https://realpython.com/courses/pygame-primer/"/>
      <updated>2020-03-17T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#39;ll learn how to use PyGame. This library allows you to create games and rich multimedia programs in Python. You&#39;ll learn how to draw items on your screen, implement collision detection, handle user input, and much more!</summary>
      <content type="html">
        &lt;p&gt;In this course, you&amp;rsquo;ll learn about creating games using Python and the library &lt;strong&gt;PyGame&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Draw items on your screen&lt;/li&gt;
&lt;li&gt;Play sound effects and music&lt;/li&gt;
&lt;li&gt;Handle user input&lt;/li&gt;
&lt;li&gt;Implement event loops&lt;/li&gt;
&lt;li&gt;Describe how game programming differs from standard procedural Python programming&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This primer assumes you have a &lt;a href=&quot;https://realpython.com/learning-paths/python3-introduction/&quot;&gt;basic understanding of writing Python programs&lt;/a&gt;, including user-defined functions, &lt;a href=&quot;https://realpython.com/courses/python-imports-101/&quot;&gt;imports&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/courses/mastering-while-loops/&quot;&gt;loops&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/courses/python-conditional-statements/&quot;&gt;conditionals&lt;/a&gt;. You should also be familiar with &lt;a href=&quot;https://realpython.com/read-write-files-python/&quot;&gt;how to open files&lt;/a&gt; on your platform. A &lt;a href=&quot;https://realpython.com/learning-paths/object-oriented-programming-oop-python/&quot;&gt;basic understanding of object-oriented Python&lt;/a&gt; is helpful as well. &lt;code&gt;pygame&lt;/code&gt; works with most versions of Python, but Python 3.6 is recommended and used throughout this article.&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>Defining Main Functions in Python</title>
      <id>https://realpython.com/courses/python-main-function/</id>
      <link href="https://realpython.com/courses/python-main-function/"/>
      <updated>2020-03-10T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#39;ll learn how Python main functions are used and some best practices to organize your code so it can be executed as a script and imported from another module.</summary>
      <content type="html">
        &lt;p&gt;Many programming languages have a special function that is automatically executed when an operating system starts to run a program. This function is usually called &lt;strong&gt;&lt;code&gt;main()&lt;/code&gt;&lt;/strong&gt; and must have a specific return type and arguments according to the language standard. On the other hand, the Python interpreter executes scripts starting at the top of the file, and there is no specific function that Python automatically executes.&lt;/p&gt;
&lt;p&gt;Nevertheless, having a defined starting point for the execution of a program is useful for understanding how a program works. Python programmers have come up with several conventions to define this starting point.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll understand:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What the special &lt;code&gt;__name__&lt;/code&gt; variable is and how Python defines it&lt;/li&gt;
&lt;li&gt;Why you would want to use a &lt;code&gt;main()&lt;/code&gt; in Python&lt;/li&gt;
&lt;li&gt;What conventions there are for defining &lt;code&gt;main()&lt;/code&gt; in Python &lt;/li&gt;
&lt;li&gt;What the best practices are for what code to put into your &lt;code&gt;main()&lt;/code&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 #0: About the Show</title>
      <id>https://realpython.com/podcasts/rpp/0/</id>
      <link href="https://realpython.com/podcasts/rpp/0/"/>
      <updated>2020-03-06T00:00:00+00:00</updated>
      <summary>A weekly Python podcast hosted by Christopher Bailey with interviews, coding tips, and conversation with guests from the Python community.

The show covers a wide range of topics including Python programming best practices, career tips, and related software development topics.

Join us to hear what&#39;s new in the world of Python programming and become a better coder.</summary>
      <content type="html">
        &lt;p&gt;A weekly Python podcast hosted by Christopher Bailey with interviews, coding tips, and conversation with guests from the Python community.

The show covers a wide range of topics including Python programming best practices, career tips, and related software development topics.

Join us to hear what&#39;s new in the world of Python programming and become a better coder.&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>
