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

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

  
    <entry>
      <title>The Real Python Podcast – Episode #87: Building a Content Aggregator and Working With RSS in Python</title>
      <id>https://realpython.com/podcasts/rpp/87/</id>
      <link href="https://realpython.com/podcasts/rpp/87/"/>
      <updated>2021-11-19T12:00:00+00:00</updated>
      <summary>Have you wanted to work with RSS feeds in Python? Maybe you&#x27;re looking for a new project to build for your portfolio that uses Django, unit tests, and custom commands. This week on the show, we have Real Python author Ricky White to talk about his recent step-by-step project titled, &quot;Build a Content Aggregator in Python.&quot;</summary>
      <content type="html">
        &lt;p&gt;Have you wanted to work with RSS feeds in Python? Maybe you&#x27;re looking for a new project to build for your portfolio that uses Django, unit tests, and custom commands. This week on the show, we have Real Python author Ricky White to talk about his recent step-by-step project titled, &quot;Build a Content Aggregator in Python.&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python News: What&#x27;s New From October 2021?</title>
      <id>https://realpython.com/python-news-october-2021/</id>
      <link href="https://realpython.com/python-news-october-2021/"/>
      <updated>2021-11-17T14:00:00+00:00</updated>
      <summary>The Python community gave a warm welcome to Python 3.10 in October 2021. In this article, you&#x27;ll catch up on some big events that happened this past month, including Python being named TIOBE&#x27;s most popular programming language.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;A culmination of great work done by volunteers worldwide, the release of &lt;strong&gt;Python 3.10&lt;/strong&gt; dominated the Python community’s news cycle in &lt;strong&gt;October 2021&lt;/strong&gt;. At the same time that this release was making new features available, Python got recognition as the top programming language for the month in the &lt;strong&gt;TIOBE Programming Community index&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;There are also some new opportunities for you to support the community by participating in the &lt;strong&gt;Python Developer Survey&lt;/strong&gt; and answering the PyCon US 2022 &lt;strong&gt;Call for Proposals&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Let’s dive into the biggest &lt;strong&gt;Python news&lt;/strong&gt; from the past month!&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-shortened&quot; data-focus=&quot;false&quot;&gt;Click here to get a Python Cheat Sheet&lt;/a&gt; and learn the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;the-python-310-release&quot;&gt;The Python 3.10 Release&lt;a class=&quot;headerlink&quot; href=&quot;#the-python-310-release&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;New versions of Python are now released &lt;a href=&quot;https://realpython.com/python39-new-features/#when-is-the-next-version-of-python-coming&quot;&gt;annually&lt;/a&gt;. We can look forward to the core developers sharing a lovely goody bag with the rest of us &lt;strong&gt;every October&lt;/strong&gt;. With Python 3.10, which came out of beta on October 4th, everyone had something exciting to anticipate.&lt;/p&gt;
&lt;p&gt;Each release of Python has a release manager who’s responsible for coordinating all changes and for building and preparing the files for distribution. The release manager for Python 3.10 and 3.11 is &lt;a href=&quot;https://twitter.com/pyblogsal&quot;&gt;Pablo Galindo Salgado&lt;/a&gt;. In a first for Python, he built and released Python &lt;strong&gt;live on YouTube&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;python-310-highlights&quot;&gt;Python 3.10 Highlights&lt;a class=&quot;headerlink&quot; href=&quot;#python-310-highlights&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The new release includes lots of improvements to the language. Among our favorites are improved &lt;strong&gt;error messages&lt;/strong&gt;, simplified syntax for &lt;strong&gt;type unions&lt;/strong&gt;, and &lt;strong&gt;structural pattern matching&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/python310-new-features/#better-error-messages&quot;&gt;Improved error messages&lt;/a&gt; will make your life easier, whether you’re a new Python developer or an experienced one. In particular, the feedback that you get when your code &lt;a href=&quot;https://realpython.com/invalid-syntax-python/&quot;&gt;isn’t valid Python&lt;/a&gt; is more pointed and actionable in Python 3.10 than in previous versions. As an example, consider the following code, where there’s no closing bracket at the end of the first line:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;news&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;errors&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;types&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;patterns&quot;&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;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;news&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 Python 3.9 and earlier, you’ll see the following if you try to run this code:&lt;/p&gt;
&lt;div class=&quot;highlight pytb&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;  File &lt;span class=&quot;nb&quot;&gt;&quot;errors.py&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;2&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;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;news&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;SyntaxError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;invalid syntax&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-october-2021/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-october-2021/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Building Lists With Python&#x27;s .append()</title>
      <id>https://realpython.com/courses/building-lists-with-python-append/</id>
      <link href="https://realpython.com/courses/building-lists-with-python-append/"/>
      <updated>2021-11-16T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how Python&#x27;s .append() works and how to use it for adding items to your list in place. You&#x27;ll also learn how to code your own stacks and queues using .append() and .pop().</summary>
      <content type="html">
        &lt;p&gt;Adding items to a list is a fairly common task in Python, so the language provides a bunch of methods and operators that can help you out with this operation. One of those methods is &lt;strong&gt;&lt;code&gt;.append()&lt;/code&gt;&lt;/strong&gt;. With &lt;code&gt;.append()&lt;/code&gt;, you can add items to the end of an existing list object. You can also use &lt;code&gt;.append()&lt;/code&gt; in a &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt; to populate lists programmatically.&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;Work with &lt;strong&gt;&lt;code&gt;.append()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Populate lists using &lt;code&gt;.append()&lt;/code&gt; and a &lt;strong&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;.append()&lt;/code&gt; with &lt;strong&gt;list comprehensions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Work with &lt;code&gt;.append()&lt;/code&gt; in &lt;strong&gt;&lt;code&gt;array.array()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;collections.deque()&lt;/code&gt;&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>Securely Deploy a Django App With Gunicorn, Nginx, &amp; HTTPS</title>
      <id>https://realpython.com/django-nginx-gunicorn/</id>
      <link href="https://realpython.com/django-nginx-gunicorn/"/>
      <updated>2021-11-15T14:00:00+00:00</updated>
      <summary>Ready to take your Django app beyond development? Learn how to securely deploy your Django web app in production over HTTPS with Gunicorn and Nginx. Along the way, you&#x27;ll explore how HTTP headers can fortify your app&#x27;s security.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Taking a &lt;strong&gt;Django&lt;/strong&gt; app from development to production is a demanding but rewarding process. This tutorial will take you through that process step by step, providing an in-depth guide that starts at square one with a no-frills Django application and adds in &lt;strong&gt;Gunicorn&lt;/strong&gt;, &lt;strong&gt;Nginx&lt;/strong&gt;, &lt;strong&gt;domain registration&lt;/strong&gt;, and security-focused &lt;strong&gt;HTTP headers&lt;/strong&gt;. After going over this tutorial, you’ll be better equipped to take your Django app into production and serve it to the world.&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 you can take your Django app &lt;strong&gt;from development to production&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How you can &lt;strong&gt;host your app&lt;/strong&gt; on a real-world public domain&lt;/li&gt;
&lt;li&gt;How to introduce &lt;strong&gt;Gunicorn&lt;/strong&gt; and &lt;strong&gt;Nginx&lt;/strong&gt; into the request and response chain&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;HTTP headers&lt;/strong&gt; can fortify your site’s HTTPS security&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To make the most out of this tutorial, you should have an introductory-level &lt;a href=&quot;https://realpython.com/learning-paths/python3-introduction/&quot;&gt;understanding of Python&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django&lt;/a&gt;, and the high-level mechanics of HTTP requests.&lt;/p&gt;
&lt;p&gt;You can download the Django project used in this tutorial by following the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/django-nginx-gunicorn-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-django-nginx-gunicorn-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the companion Django project&lt;/a&gt; used in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;starting-with-django-and-wsgiserver&quot;&gt;Starting With Django and WSGIServer&lt;a class=&quot;headerlink&quot; href=&quot;#starting-with-django-and-wsgiserver&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll use &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django&lt;/a&gt; as the framework at the core of your web app, using it for URL routing, HTML rendering, authentication, administration, and backend logic. In this tutorial, you’ll supplement the Django component with two other layers, &lt;a href=&quot;https://gunicorn.org/&quot;&gt;Gunicorn&lt;/a&gt; and &lt;a href=&quot;https://nginx.org/&quot;&gt;Nginx&lt;/a&gt;, in order to serve the application scalably. But before you do that, you’ll need to set up your environment and get the Django application itself up and running.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-a-cloud-virtual-machine-vm&quot;&gt;Setting Up a Cloud Virtual Machine (VM)&lt;a class=&quot;headerlink&quot; href=&quot;#setting-up-a-cloud-virtual-machine-vm&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;First, you’ll need to launch and set up a &lt;a href=&quot;https://en.wikipedia.org/wiki/Virtual_machine&quot;&gt;virtual machine (VM)&lt;/a&gt; on which the web application will run. You should familiarize yourself with at least one &lt;a href=&quot;https://www.redhat.com/en/topics/cloud-computing/what-is-iaas&quot;&gt;infrastructure as a service (IaaS)&lt;/a&gt; cloud service provider to provision a VM. This section will walk you through the process at a high level but won’t cover every step in detail.&lt;/p&gt;
&lt;p&gt;Using a VM to serve a web app is an example of IaaS, where you have full control over the server software. Other options besides IaaS do exist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;a href=&quot;https://realpython.com/aws-chalice-serverless-python/&quot;&gt;serverless&lt;/a&gt; architecture allows you to compose the Django app only and let a separate framework or cloud provider handle the infrastructure side.&lt;/li&gt;
&lt;li&gt;A &lt;a href=&quot;https://www.ibm.com/cloud/learn/containerization&quot;&gt;containerized&lt;/a&gt; approach allows multiple apps to run independently on the same host operating system.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For this tutorial, though, you’ll use the tried-and-true route of serving Nginx and Django directly on IaaS.&lt;/p&gt;
&lt;p&gt;Two popular options for virtual machines are &lt;a href=&quot;https://azure.microsoft.com/en-us/services/virtual-machines/&quot;&gt;Azure VMs&lt;/a&gt; and &lt;a href=&quot;https://aws.amazon.com/ec2/&quot;&gt;Amazon EC2&lt;/a&gt;. To get more help with launching the instance, you should refer to the documentation for your cloud provider:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;For Azure VMs&lt;/strong&gt;, follow their &lt;a href=&quot;https://docs.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-portal&quot;&gt;quickstart guide for creating a Linux virtual machine in the Azure portal&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;For Amazon EC2&lt;/strong&gt;, learn how to &lt;a href=&quot;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html&quot;&gt;get set up&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Django project and everything else involved in this tutorial sit on a &lt;em&gt;t2.micro&lt;/em&gt; Amazon EC2 instance running Ubuntu Server 20.04.&lt;/p&gt;
&lt;p&gt;One important component of VM setup is &lt;strong&gt;inbound security rules&lt;/strong&gt;. These are fine-grained rules that control the inbound traffic to your instance. Create the following inbound security rules for initial development, which you’ll modify in production:&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;Reference&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Port Range&lt;/th&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Custom&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;8000&lt;/td&gt;
&lt;td&gt;&lt;code&gt;my-laptop-ip-address/32&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Custom&lt;/td&gt;
&lt;td&gt;All&lt;/td&gt;
&lt;td&gt;All&lt;/td&gt;
&lt;td&gt;&lt;code&gt;security-group-id&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;&lt;code&gt;my-laptop-ip-address/32&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Now you’ll walk through these one at a time:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Rule 1&lt;/strong&gt; allows TCP over port 8000 from your personal computer’s IPv4 address, allowing you to send requests to your Django app when you serve it in development over port 8000.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rule 2&lt;/strong&gt; allows inbound traffic from network interfaces and instances that are assigned to the same security group, using the security group ID as the source. This is a rule included in the default AWS security group that you should tie to your instance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rule 3&lt;/strong&gt; allows you to access your VM via SSH from your personal computer.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You’ll also want to add an &lt;strong&gt;outbound rule&lt;/strong&gt; to allow outbound traffic to do things such as install packages:&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;Type&lt;/th&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Port Range&lt;/th&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Custom&lt;/td&gt;
&lt;td&gt;All&lt;/td&gt;
&lt;td&gt;All&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.0.0.0/0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Tying that all together, your initial AWS security rule set can consist of three inbound rules and one outbound rule. These, in turn, come from three separate security groups—the default group, a group for HTTP access, and a group for SSH access:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/django-sg-initial.ceedc13b07ae.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border w-75&quot; src=&quot;https://files.realpython.com/media/django-sg-initial.ceedc13b07ae.jpg&quot; width=&quot;507&quot; height=&quot;436&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/django-sg-initial.ceedc13b07ae.jpg&amp;amp;w=126&amp;amp;sig=58fec06434e65a385da7167e6c372f43a5372cb2 126w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/django-sg-initial.ceedc13b07ae.jpg&amp;amp;w=253&amp;amp;sig=965ea00032c61b34e36811a780c3d2db76f00ac4 253w, https://files.realpython.com/media/django-sg-initial.ceedc13b07ae.jpg 507w&quot; sizes=&quot;75vw&quot; alt=&quot;Initial security ruleset for Django app&quot; data-asset=&quot;3997&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Initial security group rule set&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;From your local computer, you can then &lt;a href=&quot;https://www.ssh.com/ssh/&quot;&gt;SSH&lt;/a&gt; into the instance:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-nginx-gunicorn/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-nginx-gunicorn/ »&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 #86: The Legacy of OLPC and Charismatic Pitfalls in Teaching Programming</title>
      <id>https://realpython.com/podcasts/rpp/86/</id>
      <link href="https://realpython.com/podcasts/rpp/86/"/>
      <updated>2021-11-12T12:00:00+00:00</updated>
      <summary>Do you remember the One Laptop Per Child program? What went wrong, and what can we learn from the program&#x27;s failure? What are the potential pitfalls of charismatic technology, and how can we avoid them when introducing students to programming? This week on the show, former guest Al Sweigart and author Morgan Ames are here to talk about her book &quot;The Charisma Machine - The Life, Death, and Legacy of One Laptop per Child.&quot;</summary>
      <content type="html">
        &lt;p&gt;Do you remember the One Laptop Per Child program? What went wrong, and what can we learn from the program&#x27;s failure? What are the potential pitfalls of charismatic technology, and how can we avoid them when introducing students to programming? This week on the show, former guest Al Sweigart and author Morgan Ames are here to talk about her book &quot;The Charisma Machine - The Life, Death, and Legacy of One Laptop per Child.&quot;&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>Advanced Visual Studio Code for Python Developers</title>
      <id>https://realpython.com/advanced-visual-studio-code-python/</id>
      <link href="https://realpython.com/advanced-visual-studio-code-python/"/>
      <updated>2021-11-10T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how you can configure, extend, and optimize Visual Studio Code for a more effective and productive Python development environment. By digging into this customizable code editor and IDE, you&#x27;ll put yourself on track to be a VS Code power user.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Visual Studio Code, or &lt;strong&gt;VS Code&lt;/strong&gt; for short, is a free and open source code editor by Microsoft. You can use VS Code as a &lt;strong&gt;lightweight code editor&lt;/strong&gt; to make quick changes, or you can configure it as an &lt;a href=&quot;https://en.wikipedia.org/wiki/Integrated_development_environment&quot;&gt;integrated development environment (IDE)&lt;/a&gt; through the use of &lt;strong&gt;third-party extensions&lt;/strong&gt;. In this tutorial, you’re going to look at how to get the most out of VS Code for Python development.&lt;/p&gt;
&lt;p&gt;During this tutorial, you’ll learn how you can &lt;strong&gt;configure&lt;/strong&gt;, &lt;strong&gt;extend&lt;/strong&gt;, and &lt;strong&gt;optimize&lt;/strong&gt; VS Code for a more effective and productive Python development environment. After finishing this tutorial, you’ll have a variety of tools to help you be more productive using VS Code. It can be a powerful tool for rapid Python development.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Customize your &lt;strong&gt;user interface&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Run and monitor &lt;strong&gt;Python tests&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lint&lt;/strong&gt; and &lt;strong&gt;format&lt;/strong&gt; your code automatically&lt;/li&gt;
&lt;li&gt;Leverage &lt;strong&gt;type annotations&lt;/strong&gt; and &lt;strong&gt;Pylance&lt;/strong&gt; to write code faster with higher accuracy&lt;/li&gt;
&lt;li&gt;Configure and utilize both &lt;strong&gt;local and remote debugging&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Set up &lt;strong&gt;data science tools&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, this tutorial is full of links, tips, and tricks to help you on your way.&lt;/p&gt;
&lt;p&gt;If you haven’t already installed &lt;a href=&quot;https://code.visualstudio.com/download&quot;&gt;Visual Studio Code&lt;/a&gt; or the &lt;a href=&quot;https://marketplace.visualstudio.com/items?itemName=ms-python.python&quot;&gt;Python extension&lt;/a&gt;, you’ll need both for this tutorial. If you’re just getting started with VS Code, you might want to check out Jon Fincher’s tutorial on &lt;a href=&quot;https://realpython.com/python-development-visual-studio-code/&quot;&gt;Python development in Visual Studio Code&lt;/a&gt; before continuing with this one.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;mastering-the-visual-studio-code-user-interface&quot;&gt;Mastering the Visual Studio Code User Interface&lt;a class=&quot;headerlink&quot; href=&quot;#mastering-the-visual-studio-code-user-interface&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By default, VS Code’s user interface is designed for everyone—whether you’re writing C++, doing front-end development with JavaScript and CSS, or using data science tools like Jupyter Notebooks. In this first section, you’ll explore how to tailor VS Code to support how you work.&lt;/p&gt;
&lt;h3 id=&quot;keyboard-shortcuts&quot;&gt;Keyboard Shortcuts&lt;a class=&quot;headerlink&quot; href=&quot;#keyboard-shortcuts&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;For almost everything that you do in VS Code, you can do it directly from the keyboard. You can map all activities in VS Code, whether they’re built-in or provided via extensions, to a keyboard shortcut.&lt;/p&gt;
&lt;p&gt;A small subset of built-in commands is already mapped in &lt;a href=&quot;https://code.visualstudio.com/docs/getstarted/keybindings&quot;&gt;Keyboard Shortcuts&lt;/a&gt;. If you want to learn these default shortcuts, print out the PDF for &lt;a href=&quot;https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf&quot;&gt;Windows&lt;/a&gt;, &lt;a href=&quot;https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf&quot;&gt;macOS&lt;/a&gt;, or &lt;a href=&quot;https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf&quot;&gt;Linux&lt;/a&gt; and pin it next to your monitor.&lt;/p&gt;
&lt;p&gt;As a Python developer, a lot of the commands you’ll use in Visual Studio Code are provided from extensions, similar to the Python extension that you already installed. These don’t come with shortcuts mapped by default, but you can configure them using VS Code’s &lt;a href=&quot;https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-shortcuts-editor&quot;&gt;Keyboard Shortcuts editor&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;using-the-keyboard-shortcuts-editor&quot;&gt;Using the Keyboard Shortcuts Editor&lt;a class=&quot;headerlink&quot; href=&quot;#using-the-keyboard-shortcuts-editor&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Open the Keyboard Shortcuts editor by going to  &lt;em&gt;File → Preferences → Keyboard Shortcuts&lt;/em&gt; or &lt;em&gt;Code → Preferences → Keyboard Shortcuts&lt;/em&gt; on macOS:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/vscode-keyboard-shortcuts.687df9891a26.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/vscode-keyboard-shortcuts.687df9891a26.png&quot; width=&quot;3130&quot; height=&quot;1736&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/vscode-keyboard-shortcuts.687df9891a26.png&amp;amp;w=782&amp;amp;sig=a1e8417ec61a7de6eba529568d87f9f7fd1f17cf 782w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/vscode-keyboard-shortcuts.687df9891a26.png&amp;amp;w=1565&amp;amp;sig=185c3e856d39e59775327e58d7496dc1b09211aa 1565w, https://files.realpython.com/media/vscode-keyboard-shortcuts.687df9891a26.png 3130w&quot; sizes=&quot;75vw&quot; alt=&quot;VS Code Keyboard Shortcut Window&quot; data-asset=&quot;3672&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;In this editor, you can see a list of all the existing shortcuts along with their details:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Command&lt;/em&gt;: The command or action to be run&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Keybinding&lt;/em&gt;: The sequence of keys to press to trigger this command, with a blank indicating that there’s no mapping&lt;/li&gt;
&lt;li&gt;&lt;em&gt;When&lt;/em&gt;: Conditions that need to be met for this keybinding to work, with a minus sign (&lt;code&gt;-&lt;/code&gt;) indicating that there are no requirements&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Source&lt;/em&gt;: Where this binding was configured, either defined by &lt;em&gt;Default&lt;/em&gt;, &lt;em&gt;User&lt;/em&gt;, or &lt;em&gt;Extension&lt;/em&gt;, the last one indicating that you provided it by installing a keymap extension&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To override an existing binding, right-click on the existing action and click &lt;em&gt;Change Keybinding&lt;/em&gt;. To assign a keybinding to a command that has no binding, double-click on it. If the key sequence you press is already assigned to something else, VS Code will warn you with a link to see which commands are mapped to this keybinding.&lt;/p&gt;
&lt;p&gt;As an example, type &lt;code&gt;python create terminal&lt;/code&gt; in the search box at the top. If no results come up, make sure you have the Python extension installed. Press &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-enter&quot;&gt;Enter&lt;/kbd&gt;&lt;/span&gt; to assign a keybinding, like &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-control&quot;&gt;Ctrl&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-alt&quot;&gt;Alt&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-t&quot;&gt;T&lt;/kbd&gt;&lt;/span&gt;, and then hit &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-enter&quot;&gt;Enter&lt;/kbd&gt;&lt;/span&gt; again.&lt;/p&gt;
&lt;p&gt;To assign that shortcut to only work when you’re editing Python code, right-click on the shortcut and select &lt;em&gt;Change When Expression&lt;/em&gt;. Enter the expression &lt;code&gt;editorLangId == &#x27;python&#x27;&lt;/code&gt;:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/vscode-screenshot-2.c1a3c78e75e1.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/vscode-screenshot-2.c1a3c78e75e1.png&quot; width=&quot;2558&quot; height=&quot;742&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/vscode-screenshot-2.c1a3c78e75e1.png&amp;amp;w=639&amp;amp;sig=802a6d799cab73696ebccf67a2df67a772d24e57 639w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/vscode-screenshot-2.c1a3c78e75e1.png&amp;amp;w=1279&amp;amp;sig=6826ae50bf45a8fddd5a8018d9af0c2dfa2ca872 1279w, https://files.realpython.com/media/vscode-screenshot-2.c1a3c78e75e1.png 2558w&quot; sizes=&quot;75vw&quot; alt=&quot;Assigned keyboard shortcut&quot; data-asset=&quot;3673&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;There are &lt;a href=&quot;https://code.visualstudio.com/api/references/when-clause-contexts&quot;&gt;more conditional operators&lt;/a&gt; to choose from if you need something more specific. Here are some examples to get you started:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;resourceFilename == &#x27;__init__.py&#x27;&lt;/code&gt;&lt;/strong&gt; when the file you’re editing is &lt;code&gt;__init__.py&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;editorLangId == &#x27;python&#x27;&lt;/code&gt;&lt;/strong&gt; when working with Python. If needed, you can also replace &lt;code&gt;&#x27;python&#x27;&lt;/code&gt; with another &lt;a href=&quot;https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers&quot;&gt;language identifier&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;editorHasSelection&lt;/code&gt;&lt;/strong&gt; for when you’re inside the editor.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once you’ve configured this extension, open up a Python file in the editor to try it out by pressing your newly assigned keyboard shortcut &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-control&quot;&gt;Ctrl&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-alt&quot;&gt;Alt&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-t&quot;&gt;T&lt;/kbd&gt;&lt;/span&gt; to open up a Python terminal.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/advanced-visual-studio-code-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/advanced-visual-studio-code-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using plt.scatter() to Visualize Data in Python</title>
      <id>https://realpython.com/courses/using-pltscatter-visualize-data-python/</id>
      <link href="https://realpython.com/courses/using-pltscatter-visualize-data-python/"/>
      <updated>2021-11-09T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to create scatter plots in Python, which are a key part of many data visualization applications. You&#x27;ll get an introduction to plt.scatter(), a versatile function in the Matplotlib module for creating scatter plots.</summary>
      <content type="html">
        &lt;p&gt;An important part of working with data is being able to &lt;strong&gt;visualize&lt;/strong&gt; it. Python has several third-party modules you can use for data visualization. One of the most popular modules is &lt;strong&gt;Matplotlib&lt;/strong&gt; and its submodule &lt;strong&gt;pyplot&lt;/strong&gt;, often referred to using the alias &lt;strong&gt;&lt;code&gt;plt&lt;/code&gt;&lt;/strong&gt;. Matplotlib provides a very versatile tool called &lt;strong&gt;&lt;code&gt;plt.scatter()&lt;/code&gt;&lt;/strong&gt; that allows you to create both basic and more complex scatter plots.&lt;/p&gt;
&lt;p&gt;&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;Create a &lt;strong&gt;scatter plot&lt;/strong&gt; using &lt;strong&gt;&lt;code&gt;plt.scatter()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the required and optional &lt;strong&gt;input parameters&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Customize scatter plots for &lt;strong&gt;basic and more advanced plots&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Represent &lt;strong&gt;more than two dimensions&lt;/strong&gt; on a scatter plot&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Build a Command-Line To-Do App With Python and Typer</title>
      <id>https://realpython.com/python-typer-cli/</id>
      <link href="https://realpython.com/python-typer-cli/"/>
      <updated>2021-11-08T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll create a to-do application for your command line using Python and Typer. While you build this app, you&#x27;ll learn the basics of Typer, a modern and versatile library for building command-line interfaces (CLI).</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Building an application to manage your &lt;strong&gt;to-do list&lt;/strong&gt; can be an interesting project when you’re learning a new programming language or trying to take your skills to the next level. In this tutorial, you’ll build a functional to-do application for the command line using Python and &lt;a href=&quot;https://typer.tiangolo.com/&quot;&gt;Typer&lt;/a&gt;, which is a relatively young library for creating powerful command-line interface (CLI) applications in almost no time.&lt;/p&gt;
&lt;p&gt;With a project like this, you’ll apply a wide set of core programming skills while building a real-world application with real features and requirements.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Build a functional &lt;strong&gt;to-do application&lt;/strong&gt; with a &lt;strong&gt;Typer CLI&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Use Typer to add &lt;strong&gt;commands&lt;/strong&gt;, &lt;strong&gt;arguments&lt;/strong&gt;, and &lt;strong&gt;options&lt;/strong&gt; to your to-do app&lt;/li&gt;
&lt;li&gt;Test your Python to-do application with Typer’s &lt;strong&gt;&lt;code&gt;CliRunner&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;pytest&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Additionally, you’ll practice your skills related to processing &lt;a href=&quot;https://realpython.com/python-json/&quot;&gt;JSON files&lt;/a&gt; by using Python’s &lt;code&gt;json&lt;/code&gt; module and managing &lt;a href=&quot;https://en.wikipedia.org/wiki/Configuration_file&quot;&gt;configuration files&lt;/a&gt; with Python’s &lt;code&gt;configparser&lt;/code&gt; module. With this knowledge, you’ll be ready to start creating CLI applications right away.&lt;/p&gt;
&lt;p&gt;You can download the entire code and all the additional resources for this to-do CLI application by clicking the link below and going to the &lt;code&gt;source_code_final/&lt;/code&gt; directory:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-typer-cli-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-typer-cli-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to build a to-do app for your command line using Python and Typer.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo&quot;&gt;Demo&lt;a class=&quot;headerlink&quot; href=&quot;#demo&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step-by-step project, you’ll build a &lt;a href=&quot;https://en.wikipedia.org/wiki/Command-line_interface&quot;&gt;command-line interface (CLI)&lt;/a&gt; application to manage a to-do list. Your application will provide a CLI based on Typer, a modern and versatile library for creating CLI applications.&lt;/p&gt;
&lt;p&gt;Before you get started, check out this demo of how your to-do application will look and work once you get to the end of this tutorial. The first part of the demo shows how to get help on working with the app. It also shows how to initialize and configure the app. The rest of the video demonstrates how to interact with the essential features, such as adding, removing, and listing to-dos:&lt;/p&gt;
&lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
  &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/591043158&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;p&gt;Nice! The application has a user-friendly CLI that allows you to set up the to-do database. Once there, you can add, remove, and complete to-dos using appropriate &lt;strong&gt;commands&lt;/strong&gt;, &lt;strong&gt;arguments&lt;/strong&gt;, and &lt;strong&gt;options&lt;/strong&gt;. If you ever get stuck, then you can ask for help using the &lt;code&gt;--help&lt;/code&gt; option with proper arguments.&lt;/p&gt;
&lt;p&gt;Do you feel like kicking off this to-do app project? Cool! In the next section, you’ll plan out how to structure the layout of the project and what tools you’ll use to build it.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When you want to start a new application, you typically start by thinking about how you want the app to work. In this tutorial, you’ll build a to-do app for the command line. You’ll call that application &lt;code&gt;rptodo&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You want your application to have a user-friendly command-line interface that allows your users to interact with the app and manage their to-do lists.&lt;/p&gt;
&lt;p&gt;To start off, you want your CLI to provide the following global options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;-v&lt;/code&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;code&gt;--version&lt;/code&gt;&lt;/strong&gt; shows the current version and exits the application.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;--help&lt;/code&gt;&lt;/strong&gt; shows the global help message for the entire application.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll see these same options in many other CLI applications out there. It’s a nice idea to provide them because most users who work with the command line expect to find them in every app.&lt;/p&gt;
&lt;p&gt;Regarding managing a to-do list, your application will provide commands to initialize the app, add and remove to-dos, and manage the to-do completion status:&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;Command&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Initializes the application’s to-do database&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;add DESCRIPTION&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds a new to-do to the database with a description&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;list&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists all the to-dos in the database&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;complete TODO_ID&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Completes a to-do by setting it as done using its ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;remove TODO_ID&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removes a to-do from the database using its ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;clear&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removes all the to-dos by clearing the database&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;These commands provide all the functionality you need to turn your to-do application into a &lt;a href=&quot;https://en.wikipedia.org/wiki/Minimum_viable_product&quot;&gt;minimum viable product (MVP)&lt;/a&gt; so that you can &lt;a href=&quot;https://realpython.com/pypi-publish-python-package/&quot;&gt;publish it to PyPI&lt;/a&gt; or the platform of your choice and start getting feedback from your users.&lt;/p&gt;
&lt;p&gt;To provide all these features in your to-do application, you’ll need to complete a few tasks:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Build a &lt;strong&gt;command-line interface&lt;/strong&gt; capable of taking and processing commands, options, and arguments&lt;/li&gt;
&lt;li&gt;Select an appropriate &lt;strong&gt;data type&lt;/strong&gt; to represent your to-dos&lt;/li&gt;
&lt;li&gt;Implement a way to &lt;strong&gt;persistently store&lt;/strong&gt; your to-do list&lt;/li&gt;
&lt;li&gt;Define a way to &lt;strong&gt;connect&lt;/strong&gt; that user interface with the to-do data&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;These tasks relate well to what is known as the Model-View-Controller design, which is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Architectural_pattern&quot;&gt;architectural pattern&lt;/a&gt;. In this pattern, the &lt;strong&gt;model&lt;/strong&gt; takes care of the data, the &lt;strong&gt;view&lt;/strong&gt; deals with the user interface, and the &lt;strong&gt;controller&lt;/strong&gt; connects both ends to make the application work.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-typer-cli/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-typer-cli/ »&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 #85: Exploring Django Templates, Tags, and Filters</title>
      <id>https://realpython.com/podcasts/rpp/85/</id>
      <link href="https://realpython.com/podcasts/rpp/85/"/>
      <updated>2021-11-05T12:00:00+00:00</updated>
      <summary>Are you getting the most out of the Django framework? It&#x27;s a powerful web framework if you&#x27;re not interested in reinventing the wheel. Django includes a useful template system with inheritance for composing reusable HTML. This week on the show, we have previous guest and Real Python author Christopher Trudeau to talk about his recent articles and courses about Django.</summary>
      <content type="html">
        &lt;p&gt;Are you getting the most out of the Django framework? It&#x27;s a powerful web framework if you&#x27;re not interested in reinventing the wheel. Django includes a useful template system with inheritance for composing reusable HTML. This week on the show, we have previous guest and Real Python author Christopher Trudeau to talk about his recent articles and courses about Django.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Build a Content Aggregator in Python</title>
      <id>https://realpython.com/build-a-content-aggregator-python/</id>
      <link href="https://realpython.com/build-a-content-aggregator-python/"/>
      <updated>2021-11-03T14:00:00+00:00</updated>
      <summary>In this project-based tutorial, you&#x27;ll build a content aggregator from scratch with Python and Django. Using custom management commands, feedparser, and django-apscheduler, you&#x27;ll set up an app to periodically parse RSS feeds for Python podcasts and display the latest episodes to your users.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In this project-based tutorial, you’ll build a &lt;strong&gt;content aggregator&lt;/strong&gt; from scratch using Python and the popular framework &lt;strong&gt;Django&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;With so much content coming out online daily, it can be time consuming to go to multiple sites and sources to consume information about your favorite subjects. This is why content aggregators are so popular and powerful, as you can use them to view all the latest news and content in one place.&lt;/p&gt;
&lt;p&gt;Whether you’re looking for a &lt;strong&gt;portfolio project&lt;/strong&gt; or ways in which to extend future projects beyond simple &lt;a href=&quot;https://en.wikipedia.org/wiki/Create,_read,_update_and_delete&quot;&gt;CRUD&lt;/a&gt; capabilities, this tutorial will have something for you.&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 work with &lt;strong&gt;RSS feeds&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to create a Django &lt;strong&gt;custom management command&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to run your custom command automatically on a &lt;strong&gt;schedule&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;unit tests&lt;/strong&gt; to test your Django app’s functionality&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Click the link below to download the code for this project and follow along as you build your own content aggregator:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/content-aggregator-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-content-aggregator-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to build a content aggregator with Django and Python in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-what-youll-build&quot;&gt;Demo: What You’ll Build&lt;a class=&quot;headerlink&quot; href=&quot;#demo-what-youll-build&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll build your own podcast content aggregator in Python named &lt;strong&gt;pyCasts!&lt;/strong&gt; by following this tutorial from start to finish.&lt;/p&gt;
&lt;p&gt;The application will be a single web page displaying the latest Python podcast episodes from &lt;a href=&quot;https://realpython.com/podcasts/rpp/&quot;&gt;The Real Python Podcast&lt;/a&gt; and the &lt;a href=&quot;https://talkpython.fm/&quot;&gt;Talk Python to Me Podcast&lt;/a&gt;. After completing this tutorial, you can practice what you’ve learned by adding more podcast feeds to the application.&lt;/p&gt;
&lt;p&gt;Here’s a quick demo video of how it will look in action:&lt;/p&gt;
&lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 &quot;&gt;
  &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/640030974&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;p&gt;There are many moving parts behind the scenes that make this work efficiently and effectively in an automated fashion. You’ll learn about all of them in this tutorial. Get ready to delve in.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In order to be able to display the content to the end user, you have several steps to follow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#step-1-setting-up-your-project&quot;&gt;Set up the project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#step-2-building-your-podcast-model&quot;&gt;Build the podcast model&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#step-3-creating-your-homepage-view&quot;&gt;Create the homepage view&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#step-4-parsing-podcast-rss-feeds&quot;&gt;Parse a podcast RSS feed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#step-5-creating-a-django-custom-command&quot;&gt;Create a Django custom command&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#step-6-adding-additional-feeds-to-your-python-content-aggregator&quot;&gt;Add additional feeds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#step-7-scheduling-tasks-with-django-apscheduler&quot;&gt;Schedule tasks with django-apscheduler&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You’ll walk through each of these over the course of this tutorial. Now you’ll look at which technologies and frameworks you’re going to use for the above steps.&lt;/p&gt;
&lt;p&gt;In order to fetch the podcast RSS feeds into your application and parse them, you’ll learn how to use the &lt;a href=&quot;https://feedparser.readthedocs.io/en/latest/&quot;&gt;feedparser&lt;/a&gt; library. You’ll use this library to extract only the newest episode data from the feed, which you’ll &lt;a href=&quot;https://en.wikipedia.org/wiki/Marshalling_(computer_science)&quot;&gt;marshall&lt;/a&gt; into an &lt;code&gt;Episode&lt;/code&gt; model and save to the database with the Django ORM.&lt;/p&gt;
&lt;p&gt;You could add this code to a script and manually run it periodically, but that would defeat the point of having an aggregator to save time. Instead, you’ll learn how to use a built-in Django tool called a &lt;a href=&quot;https://docs.djangoproject.com/en/3.1/howto/custom-management-commands/&quot;&gt;custom management command&lt;/a&gt;. To parse and save the data, you’ll run your code from within Django itself.&lt;/p&gt;
&lt;p&gt;With help from the &lt;a href=&quot;https://github.com/jcass77/django-apscheduler&quot;&gt;django-apscheduler&lt;/a&gt; library, you’ll &lt;strong&gt;set a schedule&lt;/strong&gt; for your function calls, which are also called &lt;strong&gt;jobs&lt;/strong&gt;. You can then use the Django admin panel to view which jobs ran and when. This will ensure that the fetching and parsing of your feed will happen automatically without needing admin intervention.&lt;/p&gt;
&lt;p&gt;You’ll then use the &lt;a href=&quot;https://docs.djangoproject.com/en/3.1/topics/templates/#the-django-template-language&quot;&gt;Django template engine&lt;/a&gt; to show the user the queried context—in other words, the latest episodes.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To get the most out of this tutorial, you should be comfortable with the following concepts and technologies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/learning-paths/python3-introduction/&quot;&gt;Python basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Virtual environment&lt;/a&gt; setup and usage&lt;/li&gt;
&lt;li&gt;A basic level of &lt;a href=&quot;https://www.w3schools.com/html/html_intro.asp&quot;&gt;HTML&lt;/a&gt; and &lt;a href=&quot;https://www.w3schools.com/css/css_intro.asp&quot;&gt;CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Django fundamentals, such as its &lt;a href=&quot;https://realpython.com/python-application-layouts/#django&quot;&gt;folder structure&lt;/a&gt;, &lt;a href=&quot;https://docs.djangoproject.com/en/3.1/topics/http/urls/&quot;&gt;URL routing&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/django-migrations-a-primer/&quot;&gt;migrations&lt;/a&gt;, and how to &lt;a href=&quot;https://realpython.com/django-setup/&quot;&gt;create a project and app&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You might also find it helpful to have some experience with &lt;a href=&quot;https://getbootstrap.com/&quot;&gt;Bootstrap 4&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/build-a-content-aggregator-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/build-a-content-aggregator-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>Reading Input and Writing Output in Python</title>
      <id>https://realpython.com/courses/reading-input-writing-output-python/</id>
      <link href="https://realpython.com/courses/reading-input-writing-output-python/"/>
      <updated>2021-11-02T14:00:00+00:00</updated>
      <summary>In this introductory Python course, you&#x27;ll learn how to take user input from the keyboard with the built-in function input() and how to display output to the console with the built-in function print().</summary>
      <content type="html">
        &lt;p&gt;You often need to set up a program to communicate with the outside world by obtaining input data from the user and displaying data back to the user. This course will introduce you to reading input and writing output in Python.&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;Take &lt;strong&gt;user input from the keyboard&lt;/strong&gt; with the built-in function &lt;strong&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Display &lt;strong&gt;output to the console&lt;/strong&gt; with the built-in function &lt;strong&gt;&lt;code&gt;print()&lt;/code&gt;&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>Python&#x27;s zipapp: Build Executable Zip Applications</title>
      <id>https://realpython.com/python-zipapp/</id>
      <link href="https://realpython.com/python-zipapp/"/>
      <updated>2021-11-01T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn what Python Zip applications are and how to create them quickly using the zipapp module from the standard library. You&#x27;ll also learn some alternative tools you can use to build this kind of application manually.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;A Python Zip application is a quick and cool option for you to bundle and distribute an executable application in a single &lt;strong&gt;ready-to-run file&lt;/strong&gt;, which will make your end users’ experience more pleasant. If you want to learn about Python applications and how to create them using &lt;code&gt;zipapp&lt;/code&gt; from the standard library, then this tutorial is for you.&lt;/p&gt;
&lt;p&gt;You’ll be able to create Python Zip applications as a quick and accessible way to distribute your software products to your end users and clients.&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;Python Zip application&lt;/strong&gt; is&lt;/li&gt;
&lt;li&gt;How Zip applications work &lt;strong&gt;internally&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;build&lt;/strong&gt; Python Zip applications with &lt;strong&gt;&lt;code&gt;zipapp&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;standalone Python Zip apps&lt;/strong&gt; are and how to create them&lt;/li&gt;
&lt;li&gt;How to create Python Zip apps &lt;strong&gt;manually&lt;/strong&gt; using command-line tools&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also learn about a few third-party libraries for creating Zip applications that overcome some limitations of &lt;code&gt;zipapp&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To better understand this tutorial, you need to know how to &lt;a href=&quot;https://realpython.com/python-application-layouts/&quot;&gt;structure Python application layouts&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run Python scripts&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/pypi-publish-python-package/&quot;&gt;build Python packages&lt;/a&gt;, work with &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python virtual environments&lt;/a&gt;, and install and manage dependencies with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. You also need to be comfortable using the command line or terminal.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-shortened&quot; data-focus=&quot;false&quot;&gt;Click here to get a Python Cheat Sheet&lt;/a&gt; and learn the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-python-zip-applications&quot;&gt;Getting Started With Python Zip Applications&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-python-zip-applications&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One of the most challenging problems in the Python ecosystem is finding an effective way to distribute executable applications, such as &lt;a href=&quot;https://realpython.com/python-pyqt-gui-calculator/&quot;&gt;graphical user interface (GUI)&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;command-line interface (CLI)&lt;/a&gt; programs.&lt;/p&gt;
&lt;p&gt;Compiled programming languages, such as &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt;, and &lt;a href=&quot;https://golang.org/&quot;&gt;Go&lt;/a&gt;, can generate executable files that you can run directly on different operating systems and architectures. This ability makes it easy for you to distribute software to your end users.&lt;/p&gt;
&lt;p&gt;However, Python doesn’t work like that. Python is an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-interpreted&quot;&gt;interpreted language&lt;/a&gt;, which means that you need a suitable Python interpreter to run your applications. There’s no direct way to generate a standalone executable file that doesn’t need an interpreter to run.&lt;/p&gt;
&lt;p&gt;There are many solutions out there that aim to solve this issue. You’ll find tools such as &lt;a href=&quot;https://realpython.com/pyinstaller-python/&quot;&gt;PyInstaller&lt;/a&gt;, &lt;a href=&quot;http://www.py2exe.org/&quot;&gt;py2exe&lt;/a&gt;, &lt;a href=&quot;https://py2app.readthedocs.io/en/latest/&quot;&gt;py2app&lt;/a&gt;, &lt;a href=&quot;https://nuitka.net/&quot;&gt;Nuitka&lt;/a&gt;, and more. Those tools allow you to create self-contained executable applications that you can distribute to your end users. However, setting these tools up can be a complex and challenging process.&lt;/p&gt;
&lt;p&gt;Sometimes you don’t need that extra complexity. You just need to build an executable app from a script or a small program so that you can distribute it to your end users quickly. If your application is small enough and uses pure Python code, then you can be well-served with a &lt;strong&gt;Python Zip application&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;what-is-a-python-zip-application&quot;&gt;What Is a Python Zip Application?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-a-python-zip-application&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.python.org/dev/peps/pep-0441/&quot;&gt;PEP 441 – Improving Python ZIP Application Support&lt;/a&gt; formalized the idea, terminology, and specification around &lt;strong&gt;Python Zip applications&lt;/strong&gt;. This type of application consists of a single file that uses the &lt;a href=&quot;https://en.wikipedia.org/wiki/ZIP_(file_format)&quot;&gt;ZIP file format&lt;/a&gt; and contains code that Python can execute as a program. These applications rely on Python’s ability to run code from ZIP files that have a &lt;a href=&quot;https://docs.python.org/3/library/__main__.html#module-__main__&quot;&gt;&lt;code&gt;__main__.py&lt;/code&gt;&lt;/a&gt; module at their root, which works as an entry-point script.&lt;/p&gt;
&lt;p&gt;Python has been able to run scripts from ZIP files since versions &lt;a href=&quot;https://bugs.python.org/issue1739468&quot;&gt;2.6 and 3.0&lt;/a&gt;. The steps to achieve that are pretty straightforward. You just need a ZIP file with a &lt;code&gt;__main__.py&lt;/code&gt; module at its root. You can then pass that file to Python, which adds it to &lt;a href=&quot;https://docs.python.org/3/library/sys.html#sys.path&quot;&gt;&lt;code&gt;sys.path&lt;/code&gt;&lt;/a&gt; and executes &lt;code&gt;__main__.py&lt;/code&gt; as a program. Having the application’s archive in &lt;code&gt;sys.path&lt;/code&gt; allows you to access its code through Python’s &lt;a href=&quot;https://realpython.com/python-import/#the-python-import-system&quot;&gt;import system&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As a quick example of how all that works, say you’re on a &lt;a href=&quot;https://en.wikipedia.org/wiki/Unix-like&quot;&gt;Unix-like&lt;/a&gt; operating system, such as Linux or macOS, and you run the following commands:&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;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;print(&quot;Hello, World!&quot;)&#x27;&lt;/span&gt; &amp;gt; __main__.py

&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;zip hello.zip __main__.py
&lt;span class=&quot;go&quot;&gt;  adding: __main__.py (stored 0%)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python ./hello.zip
&lt;span class=&quot;go&quot;&gt;Hello, World!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Echo_(command)&quot;&gt;&lt;code&gt;echo&lt;/code&gt; command&lt;/a&gt; to create a &lt;code&gt;__main__.py&lt;/code&gt; file containing the code &lt;code&gt;print(&quot;Hello, World!&quot;)&lt;/code&gt;. Then you use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Info-ZIP&quot;&gt;&lt;code&gt;zip&lt;/code&gt;&lt;/a&gt; command to archive &lt;code&gt;__main__.py&lt;/code&gt; into &lt;code&gt;hello.zip&lt;/code&gt;. Once you’ve done that, you can run &lt;code&gt;hello.zip&lt;/code&gt; as a program by passing the filename as an argument to the &lt;code&gt;python&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;To round up the internal structure of Python Zip applications, you need a way to tell the operating system how to execute them. The ZIP file format allows you to prepend arbitrary data at the beginning of a ZIP archive. Python Zip applications take advantage of that feature to include a standard &lt;a href=&quot;https://en.wikipedia.org/wiki/Shebang_(Unix)&quot;&gt;Unix shebang&lt;/a&gt; line in the application’s archive:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;#!/usr/bin/env python3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On Unix systems, this line tells the operating system which program to use for executing the file at hand so that you can run the file directly without the &lt;code&gt;python&lt;/code&gt; command. On Windows systems, the Python launcher properly understands the shebang line and runs the Zip application for you.&lt;/p&gt;
&lt;p&gt;Even with a shebang line, you can always execute a Python Zip application by passing the application’s filename as an argument to the &lt;code&gt;python&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;In summary, to build a Python Zip application, you need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An archive that uses the &lt;strong&gt;standard ZIP file format&lt;/strong&gt; and contains a &lt;strong&gt;&lt;code&gt;__main__.py&lt;/code&gt; module&lt;/strong&gt; at its root&lt;/li&gt;
&lt;li&gt;An optional &lt;strong&gt;shebang line&lt;/strong&gt; that specifies the appropriate &lt;strong&gt;Python interpreter&lt;/strong&gt; to run the application&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-zipapp/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-zipapp/ »&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 #84: Creating and Manipulating PDFs in Python With borb</title>
      <id>https://realpython.com/podcasts/rpp/84/</id>
      <link href="https://realpython.com/podcasts/rpp/84/"/>
      <updated>2021-10-29T12:00:00+00:00</updated>
      <summary>Have you wanted to generate PDFs from your Python project? Many of the current libraries require designing the document down at the pixel level. Would you be interested in a tool that lets you specify the page layout while it handles the specific details of laying out the text? This week on the show, we talk with Joris Schellekens about his library for creating and manipulating PDFs named borb.</summary>
      <content type="html">
        &lt;p&gt;Have you wanted to generate PDFs from your Python project? Many of the current libraries require designing the document down at the pixel level. Would you be interested in a tool that lets you specify the page layout while it handles the specific details of laying out the text? This week on the show, we talk with Joris Schellekens about his library for creating and manipulating PDFs named borb.&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>Django Templates: Implementing Custom Tags and Filters</title>
      <id>https://realpython.com/django-template-custom-tags-filters/</id>
      <link href="https://realpython.com/django-template-custom-tags-filters/"/>
      <updated>2021-10-27T14:00:00+00:00</updated>
      <summary>Django templates have many built-in tags and filters to render content, but they may not meet all your needs. This tutorial covers how to write Django custom template tags and filters, including simple tags, inclusion tags, block tags, and different types of filters.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://realpython.com/django-templates-tags-filters/&quot;&gt;Django templates&lt;/a&gt; help you manage your web application’s HTML. Templates use a mini-language with variables, tags, and filters. You can conditionally include blocks, create loops, and modify variables before they’re shown. Django comes with many built-in tags and filters, but what if they’re not enough? In that case, write your own! This tutorial covers the ins and outs of writing your own Django template custom tags and filters.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Write&lt;/strong&gt; and &lt;strong&gt;register&lt;/strong&gt; a function as a &lt;strong&gt;custom filter&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Understand how &lt;strong&gt;autoescaping&lt;/strong&gt; works in custom tags and filters&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;@simple_tag&lt;/code&gt; to write a &lt;strong&gt;custom template tag&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;@inclusion_tag&lt;/code&gt; to render a tag based on a &lt;strong&gt;subtemplate&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Write a &lt;strong&gt;complex template tag&lt;/strong&gt; with a parser and renderer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end of the tutorial, you’ll be able to write custom filters to modify data in your templates and custom tags that give you access to the full power of Python within your templates.&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;getting-started&quot;&gt;Getting Started&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To play around with your own Django template custom tags and filters, you’re going to need a Django project. You’ll build &lt;strong&gt;dinosoar&lt;/strong&gt;, a small website with all sorts of dinosaur info. Although the name implies that you’ll only include flying dinos, that’s just for marketing spin. All your favorite heavyweights will be there as well.&lt;/p&gt;
&lt;p&gt;If you’ve never set up a Django project before or if you need a refresher, you may want to read &lt;a href=&quot;https://realpython.com/get-started-with-django-1/&quot;&gt;Get Started With Django Part 1: Build a Portfolio App&lt;/a&gt; first.&lt;/p&gt;
&lt;p&gt;Django is a third-party library, so it should be installed in a virtual environment. If you’re new to virtual environments, check out &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;. Create and activate a new virtual environment for yourself and then run the following commands:&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;linenos&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m pip install &lt;span class=&quot;nv&quot;&gt;django&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.2.5
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;django-admin startproject dinosoar
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; dinosoar
&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python manage.py startapp dinofacts
&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python manage.py migrate
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These commands perform the following actions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Line 1&lt;/strong&gt; runs the &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; command to install Django.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line 2&lt;/strong&gt; creates your new Django &lt;strong&gt;project&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line 3&lt;/strong&gt; changes the current working directory to the &lt;code&gt;dinosoar&lt;/code&gt; project.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line 4&lt;/strong&gt; uses the &lt;code&gt;manage.py&lt;/code&gt; command to create a Django &lt;strong&gt;app&lt;/strong&gt; called &lt;code&gt;dinofacts&lt;/code&gt;, where your main view will live.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line 5&lt;/strong&gt; migrates any database changes. Even if you aren’t creating models, this line is necessary because the Django admin is active by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With the project created, it’s time to make some configuration changes and write a quick view to help you test your custom tags and filters.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-a-django-project&quot;&gt;Setting Up a Django Project&lt;a class=&quot;headerlink&quot; href=&quot;#setting-up-a-django-project&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You need to make some changes to your project’s settings to make Django aware of your newly created app and to configure your templates. Edit &lt;code&gt;dinosoar/dinosoar/settings.py&lt;/code&gt; and add &lt;code&gt;dinofacts&lt;/code&gt; to the &lt;code&gt;INSTALLED_APPS&lt;/code&gt; list:&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;linenos&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# dinosoar/dinosoar/settings.py&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;35&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;INSTALLED_APPS&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;linenos&quot;&gt;37&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.admin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;38&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.auth&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;39&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.contenttypes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;40&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.sessions&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;41&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.messages&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.staticfiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;linenos&quot;&gt;43&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;dinofacts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;44&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;Within the same file, you’ll need to update the &lt;code&gt;DIR&lt;/code&gt; value in the &lt;code&gt;TEMPLATES&lt;/code&gt; attribute. This tells Django where to look for your template files:&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;linenos&quot;&gt;57&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# dinosoar/dinosoar/settings.py&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;58&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;59&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TEMPLATES&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;linenos&quot;&gt;60&lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;61&lt;/span&gt;        &lt;span class=&quot;s2&quot;&gt;&quot;BACKEND&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;django.template.backends.django.DjangoTemplates&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;62&lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;        &lt;span class=&quot;s2&quot;&gt;&quot;DIRS&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;linenos&quot;&gt;63&lt;/span&gt;            &lt;span class=&quot;n&quot;&gt;BASE_DIR&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;templates&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;64&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;65&lt;/span&gt;        &lt;span class=&quot;s2&quot;&gt;&quot;APP_DIRS&quot;&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;linenos&quot;&gt;66&lt;/span&gt;        &lt;span class=&quot;s2&quot;&gt;&quot;OPTIONS&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;67&lt;/span&gt;            &lt;span class=&quot;s2&quot;&gt;&quot;context_processors&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;68&lt;/span&gt;                &lt;span class=&quot;s2&quot;&gt;&quot;django.template.context_processors.debug&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;69&lt;/span&gt;                &lt;span class=&quot;s2&quot;&gt;&quot;django.template.context_processors.request&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;70&lt;/span&gt;                &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.auth.context_processors.auth&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;71&lt;/span&gt;                &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.messages.context_processors.messages&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;72&lt;/span&gt;            &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;73&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;Starting with Django 3.1, the &lt;code&gt;BASE_DIR&lt;/code&gt; value that specifies where the project lives is a &lt;code&gt;pathlib&lt;/code&gt; object. The change to the &lt;code&gt;DIRS&lt;/code&gt; value above tells Django to look in a &lt;code&gt;templates/&lt;/code&gt; subdirectory within your project directory.&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 use Django 3.0 or earlier, you’ll set &lt;code&gt;BASE_DIR&lt;/code&gt; using the &lt;code&gt;os.path&lt;/code&gt; module. In that case, use &lt;code&gt;os.path.join()&lt;/code&gt; to specify the path.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;With the settings changed, don’t forget to create the &lt;code&gt;templates/&lt;/code&gt; directory within your project:&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;pwd&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;/home/realpython/dinosoar&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;mkdir templates
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It’s time to start writing some code. To test your custom template tags and filters, you’ll need a view. Edit &lt;code&gt;dinosoar/dinofacts/views.py&lt;/code&gt; 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;linenos&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# dinosoar/dinofacts/views.py&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;datetime&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;django.shortcuts&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;render&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 6&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;show_dino&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 7&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;linenos&quot;&gt; 8&lt;/span&gt;        &lt;span class=&quot;s2&quot;&gt;&quot;dinosaurs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 9&lt;/span&gt;            &lt;span class=&quot;s2&quot;&gt;&quot;Tyrannosaurus&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;10&lt;/span&gt;            &lt;span class=&quot;s2&quot;&gt;&quot;Stegosaurus&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;11&lt;/span&gt;            &lt;span class=&quot;s2&quot;&gt;&quot;Raptor&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;12&lt;/span&gt;            &lt;span class=&quot;s2&quot;&gt;&quot;Triceratops&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;13&lt;/span&gt;        &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;14&lt;/span&gt;        &lt;span class=&quot;s2&quot;&gt;&quot;now&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;15&lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;16&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;17&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;.html&quot;&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;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Lines 7 to 15 create a dictionary with some sample data. You’ll use this in your templates to test your tags and filters. The rest of this view does something a little unorthodox: it takes a parameter that specifies the name of a template.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-template-custom-tags-filters/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-template-custom-tags-filters/ »&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>Writing Idiomatic Python</title>
      <id>https://realpython.com/courses/writing-idiomatic-python/</id>
      <link href="https://realpython.com/courses/writing-idiomatic-python/"/>
      <updated>2021-10-26T14:00:00+00:00</updated>
      <summary>What are the programming idioms unique to Python? This course is a short overview for people coming from other languages and an introduction for beginners to the idiomatic practices within Python. You&#x27;ll cover truth values, looping, DRY principles, and the Zen of Python.</summary>
      <content type="html">
        &lt;p&gt;What programming idioms are unique to Python? This course is both a short overview for people coming from other languages as well as an introduction for programming beginners to the idiomatic practices within Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to access and interpret &lt;strong&gt;The Zen of Python&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;set up a script&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to test &lt;strong&gt;truth values&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;swap variables&lt;/strong&gt; in-place&lt;/li&gt;
&lt;li&gt;How to create Pythonic &lt;strong&gt;&lt;code&gt;for&lt;/code&gt; loops&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>Using the &quot;not&quot; Boolean Operator in Python</title>
      <id>https://realpython.com/python-not-operator/</id>
      <link href="https://realpython.com/python-not-operator/"/>
      <updated>2021-10-25T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how Python&#x27;s &quot;not&quot; operator works and how to use it in your code. You&#x27;ll get to know its features and see what kind of programming problems you can solve by using &quot;not&quot; in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;strong&gt;&lt;code&gt;not&lt;/code&gt;&lt;/strong&gt; operator allows you to invert the &lt;strong&gt;truth value&lt;/strong&gt; of Boolean expressions and objects. You can use this operator in Boolean contexts, such as &lt;code&gt;if&lt;/code&gt; statements and &lt;code&gt;while&lt;/code&gt; loops. It also works in non-Boolean contexts, which allows you to invert the truth value of your variables.&lt;/p&gt;
&lt;p&gt;Using the &lt;code&gt;not&lt;/code&gt; operator effectively will help you write accurate negative Boolean expressions to control the flow of execution in your 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;not&lt;/code&gt;&lt;/strong&gt; operator works&lt;/li&gt;
&lt;li&gt;How to use the &lt;code&gt;not&lt;/code&gt; operator in &lt;strong&gt;Boolean&lt;/strong&gt; and &lt;strong&gt;non-Boolean contexts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to use the &lt;strong&gt;&lt;code&gt;operator.not_()&lt;/code&gt;&lt;/strong&gt; function to perform logical negation&lt;/li&gt;
&lt;li&gt;How and when to avoid unnecessary &lt;strong&gt;negative logic&lt;/strong&gt; in your code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also code a few practical examples that will allow you to better understand some of the primary use cases of the &lt;code&gt;not&lt;/code&gt; operator and the best practices around its use. To get the most out of this tutorial, you should have some previous knowledge about &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean&lt;/a&gt; logic, &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;&lt;code&gt;while&lt;/code&gt; loops&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;working-with-boolean-logic-in-python&quot;&gt;Working With Boolean Logic in Python&lt;a class=&quot;headerlink&quot; href=&quot;#working-with-boolean-logic-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/George_Boole&quot;&gt;George Boole&lt;/a&gt; put together what is now known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_algebra&quot;&gt;Boolean algebra&lt;/a&gt;, which relies on &lt;strong&gt;true&lt;/strong&gt; and &lt;strong&gt;false&lt;/strong&gt; values. It also defines a set of Boolean operations: &lt;a href=&quot;https://en.wikipedia.org/wiki/Logical_conjunction&quot;&gt;&lt;code&gt;AND&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Logical_disjunction&quot;&gt;&lt;code&gt;OR&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Negation&quot;&gt;&lt;code&gt;NOT&lt;/code&gt;&lt;/a&gt;. These Boolean values and operators are helpful in programming because they help you decide the course of action in your programs.&lt;/p&gt;
&lt;p&gt;In Python, the &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean type&lt;/a&gt;, &lt;a href=&quot;https://docs.python.org/3/library/functions.html#bool&quot;&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/a&gt;, is a subclass of &lt;a href=&quot;https://docs.python.org/3/library/functions.html#int&quot;&gt;&lt;code&gt;int&lt;/code&gt;&lt;/a&gt;:&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;issubclass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;help&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Help on class bool in module builtins:&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;class bool(int)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    bool(x) -&amp;gt; bool&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This type has two possible values, &lt;code&gt;True&lt;/code&gt; and &lt;code&gt;False&lt;/code&gt;, which are &lt;a href=&quot;https://docs.python.org/3/library/constants.html#built-in-constants&quot;&gt;built-in constants&lt;/a&gt; in Python and must be capitalized. Internally, Python implements them as integer numbers:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&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;go&quot;&gt;&amp;lt;class &#x27;bool&#x27;&amp;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;type&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;span class=&quot;go&quot;&gt;&amp;lt;class &#x27;bool&#x27;&amp;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;isinstance&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;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;isinstance&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;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;int&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;go&quot;&gt;1&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;int&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;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Python internally implements its Boolean values as &lt;code&gt;1&lt;/code&gt; for &lt;code&gt;True&lt;/code&gt; and &lt;code&gt;0&lt;/code&gt; for &lt;code&gt;False&lt;/code&gt;. Go ahead and execute &lt;code&gt;True + True&lt;/code&gt; in your &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interactive&lt;/a&gt; shell to see what happens.&lt;/p&gt;
&lt;p&gt;Python provides three Boolean or logical operators:&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 class=&quot;text-left&quot;&gt;Operator&lt;/th&gt;
&lt;th class=&quot;text-left&quot;&gt;Logical Operation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;a href=&quot;https://realpython.com/python-and-operator/&quot;&gt;&lt;code&gt;and&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Conjunction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;a href=&quot;https://realpython.com/python-or-operator/&quot;&gt;&lt;code&gt;or&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Disjunction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;a href=&quot;https://realpython.com/python-keywords/#the-not-keyword&quot;&gt;&lt;code&gt;not&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Negation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;With these operators, you can build expressions by connecting &lt;a href=&quot;https://realpython.com/python-operators-expressions/#logical-expressions-involving-boolean-operands&quot;&gt;Boolean expressions&lt;/a&gt; with each other, objects with each other, and even Boolean expressions with objects. Python uses English words for the Boolean operators. These words are &lt;strong&gt;keywords&lt;/strong&gt; of the language, so you can’t use them as &lt;a href=&quot;https://docs.python.org/3/reference/lexical_analysis.html#identifiers&quot;&gt;identifiers&lt;/a&gt; without causing a &lt;a href=&quot;https://realpython.com/invalid-syntax-python/&quot;&gt;syntax error&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn about Python’s &lt;code&gt;not&lt;/code&gt; operator, which implements the logical &lt;code&gt;NOT&lt;/code&gt; operation or &lt;strong&gt;negation&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&quot;getting-started-with-pythons-not-operator&quot;&gt;Getting Started With Python’s &lt;code&gt;not&lt;/code&gt; Operator&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pythons-not-operator&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;not&lt;/code&gt; operator is the Boolean or logical operator that implements negation in Python. It’s &lt;a href=&quot;https://en.wikipedia.org/wiki/Unary_operation&quot;&gt;unary&lt;/a&gt;, which means that it takes only one &lt;strong&gt;operand&lt;/strong&gt;. The operand can be a &lt;strong&gt;Boolean expression&lt;/strong&gt; or any Python &lt;strong&gt;object&lt;/strong&gt;. Even user-defined objects work. The task of &lt;code&gt;not&lt;/code&gt; is to reverse the &lt;strong&gt;truth value&lt;/strong&gt; of its operand.&lt;/p&gt;
&lt;p&gt;If you apply &lt;code&gt;not&lt;/code&gt; to an operand that evaluates to &lt;code&gt;True&lt;/code&gt;, then you get &lt;code&gt;False&lt;/code&gt; as a result. If you apply &lt;code&gt;not&lt;/code&gt; to a false operand, then you get &lt;code&gt;True&lt;/code&gt;:&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;ow&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;False&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;ow&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;False&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;The &lt;code&gt;not&lt;/code&gt; operator negates the truth value of its operand. A true operand returns &lt;code&gt;False&lt;/code&gt;. A false operand returns &lt;code&gt;True&lt;/code&gt;. These two statements uncover what is commonly known as the &lt;strong&gt;truth table&lt;/strong&gt; of &lt;code&gt;not&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;code&gt;operand&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;not operand&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;False&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;False&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;With &lt;code&gt;not&lt;/code&gt;, you can negate the truth value of any Boolean expression or object. This functionality makes it worthwhile in several situations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Checking &lt;strong&gt;unmet conditions&lt;/strong&gt; in the context of &lt;code&gt;if&lt;/code&gt; statements and &lt;code&gt;while&lt;/code&gt; loops&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Inverting the truth value&lt;/strong&gt; of an object or expression&lt;/li&gt;
&lt;li&gt;Checking if a &lt;strong&gt;value is not in a given container&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Checking for an &lt;strong&gt;object’s identity&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-not-operator/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-not-operator/ »&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 #83: Ready to Publish Your Python Packages?</title>
      <id>https://realpython.com/podcasts/rpp/83/</id>
      <link href="https://realpython.com/podcasts/rpp/83/"/>
      <updated>2021-10-22T12:00:00+00:00</updated>
      <summary>Are you interested in sharing your Python project with the broader world? Would you like to make it easily installable using pip? How do you create Python packages that share your code in a scalable and maintainable way? This week on the show, Real Python author and former guest Dane Hillard returns to talk about his new book, &quot;Publishing Python Packages.&quot;</summary>
      <content type="html">
        &lt;p&gt;Are you interested in sharing your Python project with the broader world? Would you like to make it easily installable using pip? How do you create Python packages that share your code in a scalable and maintainable way? This week on the show, Real Python author and former guest Dane Hillard returns to talk about his new book, &quot;Publishing Python Packages.&quot;&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 the len() Function in Python</title>
      <id>https://realpython.com/len-python-function/</id>
      <link href="https://realpython.com/len-python-function/"/>
      <updated>2021-10-20T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how and when to use the len() Python function. You&#x27;ll also learn how to customize your class definitions so that objects of a user-defined class can be used as arguments in len().</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In many situations, you’ll need to find the number of items stored in a data structure. Python’s built-in function &lt;code&gt;len()&lt;/code&gt; is the tool that will help you with this task.&lt;/p&gt;
&lt;p&gt;There are some cases in which the use of &lt;code&gt;len()&lt;/code&gt; is straightforward. However, there are other times when you’ll need to understand how this function works in more detail and how to apply it to different data types.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Find the length of  &lt;strong&gt;built-in data types&lt;/strong&gt; using &lt;code&gt;len()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;len()&lt;/code&gt; with &lt;strong&gt;third-party data types&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Provide support for &lt;code&gt;len()&lt;/code&gt; with &lt;strong&gt;user-defined classes&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end of this article, you’ll know when to use the &lt;code&gt;len()&lt;/code&gt; Python function and how to use it effectively. You’ll know which built-in data types are valid arguments for &lt;code&gt;len()&lt;/code&gt; and which ones you can’t use. You’ll also understand how to use &lt;code&gt;len()&lt;/code&gt; with third-party types, such as  &lt;code&gt;ndarray&lt;/code&gt; in &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt; and &lt;code&gt;DataFrame&lt;/code&gt; in &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;pandas&lt;/a&gt;, and with your own classes.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-shortened&quot; data-focus=&quot;false&quot;&gt;Click here to get a Python Cheat Sheet&lt;/a&gt; and learn the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-pythons-len&quot;&gt;Getting Started With Python’s &lt;code&gt;len()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pythons-len&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The function &lt;a href=&quot;https://docs.python.org/3.9/library/functions.html?highlight=len#len&quot;&gt;&lt;code&gt;len()&lt;/code&gt;&lt;/a&gt; is one of Python’s built-in functions. It returns the length of an object. For example, it can return the number of items in a list. You can use the function with many different data types. However, not all data types are valid arguments for &lt;code&gt;len()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can start by looking at the help for this function:&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;help&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Help on built-in function len in module builtins:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;len(obj, /)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    Return the number of items in a container.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The function takes an object as an argument and returns the length of that object. The &lt;a href=&quot;https://docs.python.org/3/library/functions.html?highlight=len#len&quot;&gt;documentation&lt;/a&gt; for &lt;code&gt;len()&lt;/code&gt; goes a bit further:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set). (&lt;a href=&quot;https://docs.python.org/3/library/functions.html?highlight=len#len&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When you use built-in data types and many third-party types with &lt;code&gt;len()&lt;/code&gt;, the function doesn’t need to iterate through the data structure. The length of a container object is stored as an attribute of the object. The value of this attribute is modified each time items are added to or removed from the data structure, and &lt;code&gt;len()&lt;/code&gt; returns the value of the length attribute. This ensures that &lt;code&gt;len()&lt;/code&gt; works efficiently.&lt;/p&gt;
&lt;p&gt;In the following sections, you’ll learn about how to use &lt;code&gt;len()&lt;/code&gt; with sequences and collections. You’ll also learn about some data types that you cannot use as arguments for the &lt;code&gt;len()&lt;/code&gt; Python function.&lt;/p&gt;
&lt;h3 id=&quot;using-len-with-built-in-sequences&quot;&gt;Using &lt;code&gt;len()&lt;/code&gt; With Built-in Sequences&lt;a class=&quot;headerlink&quot; href=&quot;#using-len-with-built-in-sequences&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A &lt;strong&gt;sequence&lt;/strong&gt; is a container with ordered items. &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;Lists, tuples&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; are three of the basic built-in sequences in Python. You can find the length of a sequence by calling &lt;code&gt;len()&lt;/code&gt;:&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;greeting&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Good Day!&quot;&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;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;greeting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;9&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;office_days&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Tuesday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Thursday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Friday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;office_days&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;london_coordinates&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;51.50722&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.1275&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;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;london_coordinates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When finding the length of the string &lt;code&gt;greeting&lt;/code&gt;, the list &lt;code&gt;office_days&lt;/code&gt;, and the tuple &lt;code&gt;london_coordinates&lt;/code&gt;, you use &lt;code&gt;len()&lt;/code&gt; in the same manner. All three data types are valid arguments for &lt;code&gt;len()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The function &lt;code&gt;len()&lt;/code&gt; always returns an integer as it’s counting the number of items in the object that you pass to it. The function returns &lt;code&gt;0&lt;/code&gt; if the argument is an empty sequence:&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;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&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;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&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;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(())&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the examples above, you find the length of an empty string, an empty list, and an empty tuple. The function returns &lt;code&gt;0&lt;/code&gt; in each case.&lt;/p&gt;
&lt;p&gt;A &lt;code&gt;range&lt;/code&gt; object is also a sequence that you can create using &lt;a href=&quot;https://realpython.com/python-range/&quot;&gt;&lt;code&gt;range()&lt;/code&gt;&lt;/a&gt;. A &lt;code&gt;range&lt;/code&gt; object doesn’t store all the values but generates them when they’re needed. However, you can still find the length of a &lt;code&gt;range&lt;/code&gt; object using &lt;code&gt;len()&lt;/code&gt;:&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;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&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;go&quot;&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This range of numbers includes the integers from &lt;code&gt;1&lt;/code&gt; to &lt;code&gt;19&lt;/code&gt; with increments of &lt;code&gt;2&lt;/code&gt;. The length of a &lt;code&gt;range&lt;/code&gt; object can be determined from the start, stop, and step values.&lt;/p&gt;
&lt;p&gt;In this section, you’ve used the &lt;code&gt;len()&lt;/code&gt; Python function with strings, lists, tuples, and &lt;code&gt;range&lt;/code&gt; objects. However, you can also use the function with any other built-in sequence.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/len-python-function/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/len-python-function/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Assignment Expressions and Using the Walrus Operator</title>
      <id>https://realpython.com/courses/python-assignment-expressions-walrus-operator/</id>
      <link href="https://realpython.com/courses/python-assignment-expressions-walrus-operator/"/>
      <updated>2021-10-19T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn about assignment expressions and the walrus operator. The biggest change in Python 3.8 was the inclusion of the := operator, which you can use to assign variables in the middle of expressions. You&#x27;ll see several examples of how to take advantage of this new feature.</summary>
      <content type="html">
        &lt;p&gt;Each new version of Python adds new features to the language. For Python 3.8, the biggest change is the addition of &lt;strong&gt;assignment expressions&lt;/strong&gt;. Specifically, the &lt;code&gt;:=&lt;/code&gt; operator gives you a new syntax for assigning variables in the middle of expressions. This operator is colloquially known as the &lt;strong&gt;walrus operator&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This course is an in-depth introduction to the walrus operator. You&amp;rsquo;ll learn some of the motivations for the syntax update and explore some examples where assignment expressions can be useful.&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;Identify &lt;strong&gt;the walrus operator&lt;/strong&gt; and understand its meaning&lt;/li&gt;
&lt;li&gt;Understand &lt;strong&gt;use cases&lt;/strong&gt; for the walrus operator&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Avoid repetitive code&lt;/strong&gt; by using the walrus operator&lt;/li&gt;
&lt;li&gt;Convert between code using the walrus operator and code using &lt;strong&gt;other assignment methods&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Understand the impacts on &lt;strong&gt;backward compatibility&lt;/strong&gt; when using the walrus operator&lt;/li&gt;
&lt;li&gt;Use appropriate &lt;strong&gt;style&lt;/strong&gt; in your assignment expressions&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>A Roadmap to XML Parsers in Python</title>
      <id>https://realpython.com/python-xml-parser/</id>
      <link href="https://realpython.com/python-xml-parser/"/>
      <updated>2021-10-18T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what XML parsers are available in Python and how to pick the right parsing model for your specific use case. You&#x27;ll explore Python&#x27;s built-in parsers as well as major third-party libraries.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’ve ever tried to parse an &lt;strong&gt;XML document&lt;/strong&gt; in Python before, then you know how surprisingly difficult such a task can be. On the one hand, the &lt;a href=&quot;https://www.python.org/dev/peps/pep-0020/&quot;&gt;Zen of Python&lt;/a&gt; promises only one obvious way to achieve your goal. At the same time, the standard library follows the &lt;a href=&quot;https://docs.python.org/3/tutorial/stdlib.html#batteries-included&quot;&gt;batteries included&lt;/a&gt; motto by letting you choose from not one but several XML parsers. Luckily, the Python community solved this surplus problem by creating even more XML parsing libraries. &lt;/p&gt;
&lt;p&gt;Jokes aside, all XML parsers have their place in a world full of smaller or bigger challenges. It’s worthwhile to familiarize yourself with the available tools.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Choose the right XML &lt;strong&gt;parsing model&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the XML parsers in the &lt;strong&gt;standard library&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use major XML parsing &lt;strong&gt;libraries&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Parse XML documents declaratively using &lt;strong&gt;data binding&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use safe XML parsers to eliminate &lt;strong&gt;security vulnerabilities&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can use this tutorial as a &lt;strong&gt;roadmap&lt;/strong&gt; to guide you through the confusing world of XML parsers in Python. By the end of it, you’ll be able to pick the right XML parser for a given problem. To get the most out of this tutorial, you should already be familiar with &lt;a href=&quot;https://en.wikipedia.org/wiki/XML&quot;&gt;XML&lt;/a&gt; and its building blocks, as well as how to &lt;a href=&quot;https://realpython.com/working-with-files-in-python/&quot;&gt;work with files in Python&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;choose-the-right-xml-parsing-model&quot;&gt;Choose the Right XML Parsing Model&lt;a class=&quot;headerlink&quot; href=&quot;#choose-the-right-xml-parsing-model&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It turns out that you can process XML documents using a few language-agnostic strategies. Each demonstrates different memory and speed trade-offs, which can partially justify the wide range of XML parsers available in Python. In the following section, you’ll find out their differences and strengths.&lt;/p&gt;
&lt;h3 id=&quot;document-object-model-dom&quot;&gt;Document Object Model (DOM)&lt;a class=&quot;headerlink&quot; href=&quot;#document-object-model-dom&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Historically, the first and the most widespread model for parsing XML has been the DOM, or the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model&quot;&gt;Document Object Model&lt;/a&gt;, originally defined by the World Wide Web Consortium (W3C). You might have already heard about the DOM because web browsers expose a DOM interface through &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt; to let you manipulate the HTML code of your websites. Both XML and HTML belong to the same family of &lt;a href=&quot;https://en.wikipedia.org/wiki/Markup_language&quot;&gt;markup languages&lt;/a&gt;, which makes parsing XML with the DOM possible.&lt;/p&gt;
&lt;p&gt;The DOM is arguably the most straightforward and versatile model to use. It defines a handful of &lt;strong&gt;standard operations&lt;/strong&gt; for traversing and modifying document elements arranged in a hierarchy of objects. An abstract representation of the entire document tree is stored in memory, giving you &lt;strong&gt;random access&lt;/strong&gt; to the individual elements.&lt;/p&gt;
&lt;p&gt;While the DOM tree allows for fast and &lt;strong&gt;omnidirectional navigation&lt;/strong&gt;, building its abstract representation in the first place can be time-consuming. Moreover, the XML gets &lt;strong&gt;parsed at once&lt;/strong&gt;, as a whole, so it has to be reasonably small to fit the available memory. This renders the DOM suitable only for moderately large configuration files rather than multi-gigabyte &lt;a href=&quot;https://en.wikipedia.org/wiki/XML_database&quot;&gt;XML databases&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Use a DOM parser when convenience is more important than processing time and when memory is not an issue. Some typical use cases are when you need to parse a relatively small document or when you only need to do the parsing infrequently.&lt;/p&gt;
&lt;h3 id=&quot;simple-api-for-xml-sax&quot;&gt;Simple API for XML (SAX)&lt;a class=&quot;headerlink&quot; href=&quot;#simple-api-for-xml-sax&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To address the shortcomings of the DOM, the Java community came up with a library through a collaborative effort, which then became an alternative model for parsing XML in other languages. There was no formal specification, only organic discussions on a mailing list. The end result was an &lt;strong&gt;event-based streaming API&lt;/strong&gt; that operates sequentially on individual elements rather than the whole tree.&lt;/p&gt;
&lt;p&gt;Elements are processed from top to bottom in the same order they appear in the document. The parser triggers user-defined &lt;a href=&quot;https://en.wikipedia.org/wiki/Callback_(computer_programming)&quot;&gt;callbacks&lt;/a&gt; to handle specific XML nodes as it finds them in the document. This approach is known as &lt;strong&gt;“push” parsing&lt;/strong&gt; because elements are pushed to your functions by the parser.&lt;/p&gt;
&lt;p&gt;SAX also lets you discard elements if you’re not interested in them. This means it has a much lower memory footprint than DOM and can deal with arbitrarily large files, which is great for &lt;strong&gt;single-pass processing&lt;/strong&gt; such as indexing, conversion to other formats, and so on.&lt;/p&gt;
&lt;p&gt;However, finding or modifying random tree nodes is cumbersome because it usually requires multiple passes on the document and tracking the visited nodes. SAX is also inconvenient for handling deeply nested elements. Finally, the SAX model just allows for &lt;strong&gt;read-only&lt;/strong&gt; parsing.&lt;/p&gt;
&lt;p&gt;In short, SAX is cheap in terms of space and time but more difficult to use than DOM in most cases. It works well for parsing very large documents or parsing incoming XML data in real time.&lt;/p&gt;
&lt;h3 id=&quot;streaming-api-for-xml-stax&quot;&gt;Streaming API for XML (StAX)&lt;a class=&quot;headerlink&quot; href=&quot;#streaming-api-for-xml-stax&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Although somewhat less popular in Python, this third approach to parsing XML builds on top of SAX. It extends the idea of &lt;strong&gt;streaming&lt;/strong&gt; but uses a &lt;strong&gt;“pull” parsing&lt;/strong&gt; model instead, which gives you more control. You can think of StAX as an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterator&quot;&gt;iterator&lt;/a&gt; advancing a &lt;strong&gt;cursor object&lt;/strong&gt; through an XML document, where custom handlers call the parser on demand and not the other way around.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; It’s possible to combine more than one XML parsing model. For example, you can use SAX or StAX to quickly find an interesting piece of data in the document and then build a DOM representation of only that particular branch in memory.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Using StAX gives you more control over the parsing process and allows for more convenient &lt;strong&gt;state management&lt;/strong&gt;. The events in the stream are only consumed when requested, enabling &lt;a href=&quot;https://en.wikipedia.org/wiki/Lazy_evaluation&quot;&gt;lazy evaluation&lt;/a&gt;. Other than that, its performance should be on par with SAX, depending on the parser implementation.&lt;/p&gt;
&lt;h2 id=&quot;learn-about-xml-parsers-in-pythons-standard-library&quot;&gt;Learn About XML Parsers in Python’s Standard Library&lt;a class=&quot;headerlink&quot; href=&quot;#learn-about-xml-parsers-in-pythons-standard-library&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this section, you’ll take a look at Python’s built-in XML parsers, which are available to you in nearly every Python distribution. You’re going to compare those parsers against a sample &lt;a href=&quot;https://en.wikipedia.org/wiki/Scalable_Vector_Graphics&quot;&gt;Scalable Vector Graphics (SVG)&lt;/a&gt; image, which is an XML-based format. By processing the same document with different parsers, you’ll be able to choose the one that suits you best.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-xml-parser/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-xml-parser/ »&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 #82: Welcoming the CPython Developer in Residence</title>
      <id>https://realpython.com/podcasts/rpp/82/</id>
      <link href="https://realpython.com/podcasts/rpp/82/"/>
      <updated>2021-10-15T12:00:00+00:00</updated>
      <summary>Earlier this year, the Python Software Foundation announced the creation of the Developer in Residence role. The first Visionary Sponsors of the PSF have provided funding for this new role for one year. What development responsibilities does this job address? This week on the show, we talk to previous guest Łukasz Langa about becoming the first CPython Developer in Residence.</summary>
      <content type="html">
        &lt;p&gt;Earlier this year, the Python Software Foundation announced the creation of the Developer in Residence role. The first Visionary Sponsors of the PSF have provided funding for this new role for one year. What development responsibilities does this job address? This week on the show, we talk to previous guest Łukasz Langa about becoming the first CPython Developer in Residence.&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 Pygame to Build an Asteroids Game in Python</title>
      <id>https://realpython.com/courses/asteroids-game-python-pygame/</id>
      <link href="https://realpython.com/courses/asteroids-game-python-pygame/"/>
      <updated>2021-10-12T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll build a clone of the Asteroids game in Python using Pygame. Step by step, you&#x27;ll add images, input handling, game logic, sounds, and text to your program.</summary>
      <content type="html">
        &lt;p&gt;Do you want to create your own computer games but like Python too much to abandon it for a career as a game developer? There&amp;rsquo;s a solution for that! With the Pygame module, you can use your amazing Python skills to create games, from the basic to the very complex. Below, you&amp;rsquo;ll learn how to use Pygame by making a clone of the Asteroids game!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to build a complete game, including:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Loading &lt;strong&gt;images&lt;/strong&gt; and displaying them on the screen&lt;/li&gt;
&lt;li&gt;Handling &lt;strong&gt;user input&lt;/strong&gt; in order to control the game&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Moving objects&lt;/strong&gt; according to the &lt;strong&gt;game logic&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Detecting &lt;strong&gt;collisions&lt;/strong&gt; between objects&lt;/li&gt;
&lt;li&gt;Displaying &lt;strong&gt;text&lt;/strong&gt; on the screen&lt;/li&gt;
&lt;li&gt;Playing &lt;strong&gt;sounds&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #81: Exploring the New Features of Python 3.10</title>
      <id>https://realpython.com/podcasts/rpp/81/</id>
      <link href="https://realpython.com/podcasts/rpp/81/"/>
      <updated>2021-10-08T12:00:00+00:00</updated>
      <summary>Python 3.10 is here! This week on the show, two former guests and Real Python authors return to talk about the new version. Geir Arne Hjelle&#x27;s article was posted to the site Monday, and it&#x27;s titled &quot;Python 3.10: Cool New Features for You to Try&quot;. Christopher Trudeau&#x27;s video course came out on Tuesday, and it covers the topics from the article with multiple visual examples of Python 3.10 code.</summary>
      <content type="html">
        &lt;p&gt;Python 3.10 is here! This week on the show, two former guests and Real Python authors return to talk about the new version. Geir Arne Hjelle&#x27;s article was posted to the site Monday, and it&#x27;s titled &quot;Python 3.10: Cool New Features for You to Try&quot;. Christopher Trudeau&#x27;s video course came out on Tuesday, and it covers the topics from the article with multiple visual examples of Python 3.10 code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Cool New Features in Python 3.10</title>
      <id>https://realpython.com/courses/cool-new-features-python-310/</id>
      <link href="https://realpython.com/courses/cool-new-features-python-310/"/>
      <updated>2021-10-05T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll explore some of the coolest and most useful features in Python 3.10. You&#x27;ll appreciate more user-friendly error messages, learn about how you can handle complicated data structures with structural pattern matching, and explore new enhancements to Python&#x27;s type system.</summary>
      <content type="html">
        &lt;p&gt;Python 3.10 is out! Volunteers have been working on the new version since May 2020 to bring you a better, faster, and more secure Python. As of &lt;a href=&quot;https://www.python.org/dev/peps/pep-0619/&quot;&gt;October 4, 2021&lt;/a&gt;, the first official version is available.&lt;/p&gt;
&lt;p&gt;Each new version of Python brings a host of changes. You can read about all of them in the &lt;a href=&quot;https://docs.python.org/3.10/whatsnew/3.10.html&quot;&gt;documentation&lt;/a&gt;. Here, you&amp;rsquo;ll get to learn about the coolest new features.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Debugging with more helpful and precise &lt;strong&gt;error messages&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;structural pattern matching&lt;/strong&gt; to work with data structures&lt;/li&gt;
&lt;li&gt;Adding more readable and more specific &lt;strong&gt;type hints&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Checking the &lt;strong&gt;length of sequences&lt;/strong&gt; when using &lt;code&gt;zip()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Calculating &lt;strong&gt;multivariable statistics&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #80: Make Your Python App Interactive With a Text User Interface (TUI)</title>
      <id>https://realpython.com/podcasts/rpp/80/</id>
      <link href="https://realpython.com/podcasts/rpp/80/"/>
      <updated>2021-10-01T12:00:00+00:00</updated>
      <summary>Have you wanted to create a Python application that goes further than a command-line interface? You would like it to have a friendly interface but don&#x27;t want to make a GUI (Graphical User Interface) or web application. Maybe a TUI (Text User Interface)would be a perfect fit for the project. This week on the show, we have Will McGugan to talk about his projects Textual and Rich.</summary>
      <content type="html">
        &lt;p&gt;Have you wanted to create a Python application that goes further than a command-line interface? You would like it to have a friendly interface but don&#x27;t want to make a GUI (Graphical User Interface) or web application. Maybe a TUI (Text User Interface)would be a perfect fit for the project. This week on the show, we have Will McGugan to talk about his projects Textual and Rich.&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>Rock, Paper, Scissors With Python: A Command Line Game</title>
      <id>https://realpython.com/courses/python-rock-paper-scissors-game/</id>
      <link href="https://realpython.com/courses/python-rock-paper-scissors-game/"/>
      <updated>2021-09-28T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn to program rock paper scissors in Python from scratch. You&#x27;ll learn how to take in user input, make the computer choose a random action, determine a winner, and split your code into functions.</summary>
      <content type="html">
        &lt;p&gt;Game programming is a great way to learn how to program. You use many tools that you&amp;rsquo;ll see in the real world, plus you get to play a game to test your results! An ideal game to start your Python game programming journey is &lt;a href=&quot;https://en.wikipedia.org/wiki/Rock_paper_scissors&quot;&gt;rock paper scissors&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Code your own &lt;strong&gt;rock paper scissors&lt;/strong&gt; game &lt;/li&gt;
&lt;li&gt;Take in user input with &lt;strong&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Play several games in a row using a &lt;strong&gt;&lt;code&gt;while&lt;/code&gt; loop&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Clean up your code with &lt;strong&gt;&lt;code&gt;Enum&lt;/code&gt;&lt;/strong&gt; objects and &lt;strong&gt;functions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Define more complex rules with a &lt;strong&gt;dictionary&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #79: Measuring Your Python Learning Progress</title>
      <id>https://realpython.com/podcasts/rpp/79/</id>
      <link href="https://realpython.com/podcasts/rpp/79/"/>
      <updated>2021-09-24T12:00:00+00:00</updated>
      <summary>Where are you along the path of learning Python? Do you feel like you&#x27;re making progress? What are ways you can put the learning path into a more precise focus? This week on the show, we talk with previous guest Martin Breuss about his recent article &quot;How Long Does It Take to Learn Python?&quot;</summary>
      <content type="html">
        &lt;p&gt;Where are you along the path of learning Python? Do you feel like you&#x27;re making progress? What are ways you can put the learning path into a more precise focus? This week on the show, we talk with previous guest Martin Breuss about his recent article &quot;How Long Does It Take to Learn Python?&quot;&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>Pass by Reference in Python: Best Practices</title>
      <id>https://realpython.com/courses/pass-by-reference-python-best-practices/</id>
      <link href="https://realpython.com/courses/pass-by-reference-python-best-practices/"/>
      <updated>2021-09-21T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll explore the concept of passing by reference and learn how it relates to Python&#x27;s own system for handling function arguments. You&#x27;ll look at several use cases for passing by reference and learn some best practices for implementing pass-by-reference constructs in Python.</summary>
      <content type="html">
        &lt;p&gt;After gaining some familiarity with Python, you may notice cases in which your functions don&amp;rsquo;t modify arguments in place as you might expect, especially if you&amp;rsquo;re familiar with other programming languages. Some languages handle function arguments as &lt;strong&gt;references&lt;/strong&gt; to existing &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt;, which is known as &lt;strong&gt;pass by reference&lt;/strong&gt;. Other languages handle them as &lt;strong&gt;independent values&lt;/strong&gt;, an approach known as &lt;strong&gt;pass by value&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re an intermediate Python programmer who wishes to understand Python&amp;rsquo;s peculiar way of handling function arguments, then this course is for you. You&amp;rsquo;ll implement real use cases of pass-by-reference constructs in Python and learn several best practices to avoid pitfalls with your function arguments.&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 it means to &lt;strong&gt;pass by reference&lt;/strong&gt; and why you&amp;rsquo;d want to do so&lt;/li&gt;
&lt;li&gt;How passing by reference differs from both &lt;strong&gt;passing by value&lt;/strong&gt; and &lt;strong&gt;Python&amp;rsquo;s unique approach&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;function arguments&lt;/strong&gt; behave in Python&lt;/li&gt;
&lt;li&gt;How you can use certain &lt;strong&gt;mutable types&lt;/strong&gt; to pass by reference in Python&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;best practices&lt;/strong&gt; are for replicating pass by reference in Python&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 #78: Learning Python Through Illustrated Stories</title>
      <id>https://realpython.com/podcasts/rpp/78/</id>
      <link href="https://realpython.com/podcasts/rpp/78/"/>
      <updated>2021-09-17T12:00:00+00:00</updated>
      <summary>Are you a visual learner? Does it help to have programming concepts shared with concrete examples and images? Would you like to see if your child might be interested in programming? This week on the show, we talk with author Shari Eskenas about her books, &quot;A Day in Code - Python: Learn to Code in Python Through an Illustrated Story&quot; and &quot;Learn Python Through Nursery Rhymes &amp; Fairy Tales.&quot;</summary>
      <content type="html">
        &lt;p&gt;Are you a visual learner? Does it help to have programming concepts shared with concrete examples and images? Would you like to see if your child might be interested in programming? This week on the show, we talk with author Shari Eskenas about her books, &quot;A Day in Code - Python: Learn to Code in Python Through an Illustrated Story&quot; and &quot;Learn Python Through Nursery Rhymes &amp; Fairy Tales.&quot;&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 Data Classes in Python</title>
      <id>https://realpython.com/courses/python-data-classes/</id>
      <link href="https://realpython.com/courses/python-data-classes/"/>
      <updated>2021-09-14T14:00:00+00:00</updated>
      <summary>Data classes are one of the new features introduced in Python 3.7. When using data classes, you don&#x27;t have to write boilerplate code to get proper initialization, representation, and comparisons for your objects.</summary>
      <content type="html">
        &lt;p&gt;One &lt;a href=&quot;https://realpython.com/python37-new-features/&quot;&gt;new and exciting feature that came out in Python 3.7&lt;/a&gt; was the data class. A data class is a class typically containing mainly data, although there aren&amp;rsquo;t really any restrictions.&lt;/p&gt;
&lt;p&gt;With data classes, you don&amp;rsquo;t have to write boilerplate code to get proper initialization, representation, and comparisons for your objects.&lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Define your own &lt;strong&gt;data classes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;default values&lt;/strong&gt; to the fields in your data class&lt;/li&gt;
&lt;li&gt;Customize the &lt;strong&gt;ordering&lt;/strong&gt; of data class objects&lt;/li&gt;
&lt;li&gt;Work with &lt;strong&gt;immutable data classes&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>
  

</feed>
