<?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>2022-03-04T12:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>The Real Python Podcast – Episode #100: Defining Optional Arguments and Moving Beyond &quot;Beginner&quot; Python</title>
      <id>https://realpython.com/podcasts/rpp/100/</id>
      <link href="https://realpython.com/podcasts/rpp/100/"/>
      <updated>2022-03-04T12:00:00+00:00</updated>
      <summary>How do you define Python functions that accept optional arguments or default values? Are you wondering how to go beyond being a beginner with Python? This week on the show, Christopher Trudeau is here, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;How do you define Python functions that accept optional arguments or default values? Are you wondering how to go beyond being a beginner with Python? This week on the show, Christopher Trudeau is here, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Manage Your To-Do Lists Using Python and Django</title>
      <id>https://realpython.com/django-todo-lists/</id>
      <link href="https://realpython.com/django-todo-lists/"/>
      <updated>2022-03-02T14:00:00+00:00</updated>
      <summary>Use Django to build a to-do list manager app. This step-by-step project will teach you how to use Django&#x27;s class-based views to build a powerful app while dramatically reducing your development time.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Have you ever struggled to keep track of the things that you need to do? Perhaps you’re in the habit of using a handwritten to-do list to remind you of what needs doing, and by when. But handwritten notes have a way of getting lost or forgotten.
Because you’re a Python coder, it makes sense to build a Django to-do list manager!&lt;/p&gt;
&lt;p&gt;In this step-by-step tutorial, you’re going to create a web app using Django. You’ll learn how Django can integrate with a database that stores all your to-do items in lists that you can define. Each item will have a title, a description, and a deadline. With this app, you can manage your own deadlines and help your entire team stay on track!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;web app&lt;/strong&gt; using Django&lt;/li&gt;
&lt;li&gt;Build a &lt;strong&gt;data model&lt;/strong&gt; with &lt;strong&gt;one-to-many relationships&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the &lt;strong&gt;Django admin&lt;/strong&gt; interface to explore your data model and add test data&lt;/li&gt;
&lt;li&gt;Design &lt;a href=&quot;https://docs.djangoproject.com/en/4.0/topics/templates/&quot;&gt;templates&lt;/a&gt; for displaying your lists&lt;/li&gt;
&lt;li&gt;Leverage &lt;strong&gt;class-based views&lt;/strong&gt; to handle the standard database operations&lt;/li&gt;
&lt;li&gt;Control the Django &lt;strong&gt;URL dispatcher&lt;/strong&gt; by creating &lt;strong&gt;URL configurations&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Along the way, you’ll learn how Django’s &lt;a href=&quot;https://docs.djangoproject.com/en/4.0/topics/class-based-views/&quot;&gt;class-based views&lt;/a&gt; leverage the power of &lt;a href=&quot;https://en.wikipedia.org/wiki/Object-oriented_programming&quot;&gt;object-oriented programming&lt;/a&gt;. That’ll save you a ton of development effort!&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-todo-lists-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-django-todo-lists-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 your to-do list app.&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 tutorial, you’ll build a Django to-do list manager. Your main page will display all of your to-do lists. By clicking the &lt;em&gt;Add a new list&lt;/em&gt; button, you’ll display a page where you can name and create a new list:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/662503907?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;You’ll be able to add to-do items to your list by clicking &lt;em&gt;Add a new item&lt;/em&gt;. There, you can give your item a title, and you can add more details in the &lt;em&gt;Description&lt;/em&gt; box. You can even set a due date.&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;To build this app, you’ll start by creating a virtual environment and setting up a Django project.
Next, you’ll design a &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_model&quot;&gt;data model&lt;/a&gt; that represents the relationships between to-do items and lists.
You’ll use Django’s built-in &lt;a href=&quot;https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping&quot;&gt;object-relational mapping&lt;/a&gt; tool to automatically generate the database and tables that’ll support this model.&lt;/p&gt;
&lt;p&gt;As you develop your Django to-do list app, you’ll use Django’s handy &lt;a href=&quot;https://docs.djangoproject.com/en/4.0/ref/django-admin/#runserver&quot;&gt;&lt;code&gt;runserver&lt;/code&gt;&lt;/a&gt; command whenever you need to verify that things are working as expected. This can help even before your web pages are ready, thanks to Django’s ready-made &lt;a href=&quot;https://docs.djangoproject.com/en/4.0/ref/contrib/admin/&quot;&gt;admin&lt;/a&gt; interface.&lt;/p&gt;
&lt;p&gt;Next, you’ll develop your own web pages to display your app. In Django, these take the form of &lt;a href=&quot;https://docs.djangoproject.com/en/4.0/topics/templates/&quot;&gt;templates&lt;/a&gt;. Templates are skeleton HTML pages that can be populated with real application data.&lt;/p&gt;
&lt;p&gt;Templates aren’t meant to provide much logic, such as deciding which template to display and what data to send it. To perform that logic, you’ll need &lt;a href=&quot;https://docs.djangoproject.com/en/4.0/topics/http/views/&quot;&gt;views&lt;/a&gt;. Django’s views are the natural home for the application’s logic.&lt;/p&gt;
&lt;p&gt;You’ll code views and templates for list creation and updates, as well as for the items that those lists will contain.
You’ll learn how to use Django’s &lt;a href=&quot;https://docs.djangoproject.com/en/4.0/topics/http/urls/&quot;&gt;URL dispatcher&lt;/a&gt; to connect your pages and pass them the data that they need.
Next, you’ll add more views and templates that enable your users to delete lists and items.&lt;/p&gt;
&lt;p&gt;Finally, you’ll test your new user interface by adding, editing, and deleting to-do lists and to-do items.&lt;/p&gt;
&lt;p&gt;By completing this project, you’ll learn how to build this app and also understand how the various components fit together. Then, you’ll be ready to undertake your next Django project on your own.&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 complete this tutorial, you should be comfortable with the following skills:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/interacting-with-python/#running-a-python-script-from-the-command-line&quot;&gt;Running Python scripts from the command line&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;Coding in Python IDLE&lt;/a&gt;, or your favorite code editor &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;Using Python modules and packages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;Understanding object-oriented programming in Python&lt;/a&gt;, including &lt;a href=&quot;https://realpython.com/inheritance-composition-python/&quot;&gt;object inheritance&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you don’t have all of the prerequisite knowledge before starting this tutorial, that’s okay. In fact, you might learn more by going ahead and getting started! You can always stop and review the resources linked here if you get stuck.&lt;/p&gt;
&lt;p&gt;You don’t need to have used Django before, because you’ll get step-by-step instructions for installing and using it below. However, if you’re interested in a more detailed introduction to this powerful web framework, there’s a whole range of &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django tutorials&lt;/a&gt; that you can consult.&lt;/p&gt;
&lt;h2 id=&quot;step-1-set-up-your-virtual-environment-and-django&quot;&gt;Step 1: Set Up Your Virtual Environment and Django&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-set-up-your-virtual-environment-and-django&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step, you’re going to perform a few standard housekeeping tasks that you should only need to do once per Django project. Specifically, you’ll make and activate a virtual environment, install Django, and test that Django is installed correctly.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-todo-lists/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-todo-lists/ »&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>Exploring the Fibonacci Sequence With Python</title>
      <id>https://realpython.com/courses/python-fibonacci-sequence/</id>
      <link href="https://realpython.com/courses/python-fibonacci-sequence/"/>
      <updated>2022-03-01T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll explore the Fibonacci sequence in Python, which serves as an invaluable springboard into the world of recursion, and learn how to optimize recursive algorithms in the process.</summary>
      <content type="html">
        &lt;p&gt;The &lt;strong&gt;Fibonacci sequence&lt;/strong&gt; is a pretty famous sequence of integer numbers. The sequence comes up naturally in many problems and has a nice recursive definition. Learning how to generate it is an essential step in the pragmatic programmer&amp;rsquo;s journey toward mastering &lt;a href=&quot;https://realpython.com/python-recursion/&quot;&gt;recursion&lt;/a&gt;. In this video course, you&amp;rsquo;ll focus on learning what the Fibonacci sequence is and how to generate it using Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Generate the Fibonacci sequence using a &lt;strong&gt;recursive algorithm&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Optimize the recursive Fibonacci algorithm using &lt;strong&gt;memoization&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Generate the Fibonacci sequence using an &lt;strong&gt;iterative algorithm&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 urllib.request for HTTP Requests</title>
      <id>https://realpython.com/urllib-request/</id>
      <link href="https://realpython.com/urllib-request/"/>
      <updated>2022-02-28T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll be making HTTP requests with Python&#x27;s built-in urllib.request. You&#x27;ll try out examples and review common errors encountered, all while learning more about HTTP requests and Python in general.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you need to make HTTP requests with Python, then you may find yourself directed to the brilliant &lt;a href=&quot;https://docs.python-requests.org/en/latest/&quot;&gt;&lt;code&gt;requests&lt;/code&gt;&lt;/a&gt; library. Though it’s a great library, you may have noticed that it’s not a built-in part of Python. If you prefer, for whatever reason, to limit your dependencies and stick to standard-library Python, then you can reach for &lt;code&gt;urllib.request&lt;/code&gt;!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn how to make basic &lt;a href=&quot;https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_and_response_messages_through_connections&quot;&gt;&lt;strong&gt;HTTP requests&lt;/strong&gt;&lt;/a&gt; with &lt;code&gt;urllib.request&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Dive into the nuts and bolts of an &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages&quot;&gt;&lt;strong&gt;HTTP message&lt;/strong&gt;&lt;/a&gt; and how &lt;code&gt;urllib.request&lt;/code&gt; represents it &lt;/li&gt;
&lt;li&gt;Understand how to deal with &lt;strong&gt;character encodings&lt;/strong&gt; of HTTP messages&lt;/li&gt;
&lt;li&gt;Explore some &lt;strong&gt;common errors&lt;/strong&gt; when using &lt;code&gt;urllib.request&lt;/code&gt; and learn how to resolve them&lt;/li&gt;
&lt;li&gt;Dip your toes into the world of &lt;strong&gt;authenticated requests&lt;/strong&gt; with &lt;code&gt;urllib.request&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Understand why both &lt;code&gt;urllib&lt;/code&gt; and the &lt;code&gt;requests&lt;/code&gt; library exist and &lt;strong&gt;when to use one or the other&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’ve heard of HTTP requests, including &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET&quot;&gt;GET&lt;/a&gt; and &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST&quot;&gt;POST&lt;/a&gt;, then you’re probably ready for this tutorial. Also, you should’ve already used Python to &lt;a href=&quot;https://realpython.com/read-write-files-python/&quot;&gt;read and write to files&lt;/a&gt;, ideally with a &lt;a href=&quot;https://realpython.com/python-with-statement/&quot;&gt;context manager&lt;/a&gt;, at least once.&lt;/p&gt;
&lt;p&gt;Ultimately, you’ll find that making a request doesn’t have to be a frustrating experience, although it does tend to have that reputation. Many of the issues that you tend to run into are due to the inherent complexity of this marvelous thing called the Internet. The good news is that the &lt;code&gt;urllib.request&lt;/code&gt; module can help to demystify much of this complexity.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Learn More:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-newsletter-community&quot; data-focus=&quot;false&quot;&gt;Click here to join 290,000+ Python developers on the Real Python Newsletter&lt;/a&gt; and get new Python tutorials and news that will make you a more effective Pythonista.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;basic-http-get-requests-with-urllibrequest&quot;&gt;Basic HTTP GET Requests With &lt;code&gt;urllib.request&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#basic-http-get-requests-with-urllibrequest&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before diving into the deep end of what an HTTP request is and how it works, you’re going to get your feet wet by making a basic GET request to a &lt;a href=&quot;https://www.iana.org/domains/reserved&quot;&gt;sample URL&lt;/a&gt;. You’ll also make a GET request to a mock &lt;a href=&quot;https://realpython.com/api-integration-in-python/&quot;&gt;REST API&lt;/a&gt; for some &lt;a href=&quot;https://realpython.com/python-json/&quot;&gt;JSON&lt;/a&gt; data. In case you’re wondering about POST Requests, you’ll be covering them &lt;a href=&quot;#post-requests-with-urllibrequest&quot;&gt;later in the tutorial&lt;/a&gt;, once you have some more knowledge of &lt;code&gt;urllib.request&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Beware:&lt;/strong&gt; Depending on your exact setup, you may find that some of these examples don’t work. If so, skip ahead to the section on common &lt;a href=&quot;#common-urllibrequest-troubles&quot;&gt;&lt;code&gt;urllib.request&lt;/code&gt; errors&lt;/a&gt; for troubleshooting.&lt;/p&gt;
&lt;p&gt;If you’re running into a problem that’s not covered there, be sure to comment below with a precise and reproducible example.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To get started, you’ll make a request to &lt;code&gt;www.example.com&lt;/code&gt;, and the server will return an HTTP message. Ensure that you’re using Python 3 or above, and then use the &lt;code&gt;urlopen()&lt;/code&gt; function from &lt;code&gt;urllib.request&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;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;urllib.request&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://www.example.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;b&#x27;&amp;lt;!doctype html&amp;gt;&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, you import &lt;code&gt;urlopen()&lt;/code&gt; from &lt;code&gt;urllib.request&lt;/code&gt;. Using the &lt;a href=&quot;https://realpython.com/python-with-statement/&quot;&gt;context manager&lt;/a&gt; &lt;code&gt;with&lt;/code&gt;, you make a request and receive a response with &lt;code&gt;urlopen()&lt;/code&gt;. Then you read the body of the response and close the response object. With that, you display the first fifteen positions of the body, noting that it looks like an HTML document.&lt;/p&gt;
&lt;p&gt;There you are! You’ve successfully made a request, and you received a response. By inspecting the content, you can tell that it’s likely an HTML document. Note that the printed output of the body is preceded by &lt;code&gt;b&lt;/code&gt;. This indicates a &lt;a href=&quot;https://docs.python.org/3/reference/lexical_analysis.html#strings&quot;&gt;bytes literal&lt;/a&gt;, which you may need to decode. Later in the tutorial, you’ll learn how to turn bytes into a &lt;a href=&quot;#going-from-bytes-to-strings&quot;&gt;string&lt;/a&gt;, write them to a &lt;a href=&quot;#going-from-bytes-to-file&quot;&gt;file&lt;/a&gt;, or parse them into a &lt;a href=&quot;#going-from-bytes-to-dictionary&quot;&gt;dictionary&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The process is only slightly different if you want to make calls to REST APIs to get JSON data. In the following example, you’ll make a request to &lt;a href=&quot;https://jsonplaceholder.typicode.com&quot;&gt;{JSON}Placeholder&lt;/a&gt; for some fake to-do data:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;urllib.request&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;json&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;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://jsonplaceholder.typicode.com/todos/1&quot;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;todo_item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;todo_item&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{&#x27;userId&#x27;: 1, &#x27;id&#x27;: 1, &#x27;title&#x27;: &#x27;delectus aut autem&#x27;, &#x27;completed&#x27;: False}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, you’re doing pretty much the same as in the previous example. But in this one, you import &lt;code&gt;urllib.request&lt;/code&gt; &lt;em&gt;and&lt;/em&gt; &lt;code&gt;json&lt;/code&gt;, using the &lt;code&gt;json.loads()&lt;/code&gt; function with &lt;code&gt;body&lt;/code&gt; to decode and parse the returned JSON bytes into a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;Python dictionary&lt;/a&gt;. Voila!&lt;/p&gt;
&lt;p&gt;If you’re lucky enough to be using error-free &lt;a href=&quot;https://en.wikipedia.org/wiki/Web_API#Endpoints&quot;&gt;endpoints&lt;/a&gt;, such as the ones in these examples, then maybe the above is all that you need from &lt;code&gt;urllib.request&lt;/code&gt;. Then again, you may find that it’s not enough.&lt;/p&gt;
&lt;p&gt;Now, before doing some &lt;code&gt;urllib.request&lt;/code&gt; troubleshooting, you’ll first gain an understanding of the underlying structure of HTTP messages and learn how &lt;code&gt;urllib.request&lt;/code&gt; handles them. This understanding will provide a solid foundation for troubleshooting many different kinds of issues.&lt;/p&gt;
&lt;h2 id=&quot;the-nuts-and-bolts-of-http-messages&quot;&gt;The Nuts and Bolts of HTTP Messages&lt;a class=&quot;headerlink&quot; href=&quot;#the-nuts-and-bolts-of-http-messages&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To understand some of the issues that you may encounter when using &lt;code&gt;urllib.request&lt;/code&gt;, you’ll need to examine how a response is represented by &lt;code&gt;urllib.request&lt;/code&gt;. To do that, you’ll benefit from a high-level overview of what an &lt;strong&gt;HTTP message&lt;/strong&gt; is, which is what you’ll get in this section.&lt;/p&gt;
&lt;p&gt;Before the high-level overview, a quick note on reference sources. If you want to get into the technical weeds, the &lt;a href=&quot;https://www.ietf.org/&quot;&gt;Internet Engineering Task Force (IETF)&lt;/a&gt; has an extensive set of &lt;a href=&quot;https://www.ietf.org/standards/rfcs/&quot;&gt;Request for Comments (RFC)&lt;/a&gt; documents. These documents end up becoming the actual specifications for things like HTTP messages. &lt;a href=&quot;https://datatracker.ietf.org/doc/html/rfc7230&quot;&gt;RFC 7230, part 1: Message Syntax and Routing&lt;/a&gt;, for example, is all about the HTTP message.&lt;/p&gt;
&lt;p&gt;If you’re looking for some reference material that’s a bit easier to digest than RFCs, then the &lt;a href=&quot;https://developer.mozilla.org/&quot;&gt;Mozilla Developer Network (MDN)&lt;/a&gt; has a great range of reference articles. For example, their article on &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages&quot;&gt;HTTP messages&lt;/a&gt;, while still technical, is a lot more digestible.&lt;/p&gt;
&lt;p&gt;Now that you know about these essential sources of reference information, in the next section you’ll get a beginner-friendly overview of HTTP messages.&lt;/p&gt;
&lt;h3 id=&quot;understanding-what-an-http-message-is&quot;&gt;Understanding What an HTTP Message Is&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-what-an-http-message-is&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In a nutshell, an HTTP message can be understood as text, transmitted as a stream of &lt;a href=&quot;https://en.wikipedia.org/wiki/Byte&quot;&gt;bytes&lt;/a&gt;, structured to follow the guidelines specified by RFC 7230. A decoded HTTP message can be as simple as two lines:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/urllib-request/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/urllib-request/ »&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 #99: OAuth 2 and Authentication Choices for Your Python Project</title>
      <id>https://realpython.com/podcasts/rpp/99/</id>
      <link href="https://realpython.com/podcasts/rpp/99/"/>
      <updated>2022-02-25T12:00:00+00:00</updated>
      <summary>Have you thought about what authentication system you want to use for your Python project? Should you use an existing Python library or a third-party service? This week on the show, Dan Moore is here to talk about authentication systems and OAuth 2.</summary>
      <content type="html">
        &lt;p&gt;Have you thought about what authentication system you want to use for your Python project? Should you use an existing Python library or a third-party service? This week on the show, Dan Moore is here to talk about authentication systems and OAuth 2.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s assert: Debug and Test Your Code Like a Pro</title>
      <id>https://realpython.com/python-assert-statement/</id>
      <link href="https://realpython.com/python-assert-statement/"/>
      <updated>2022-02-23T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use Python&#x27;s assert statement to document, debug, and test code in development. You&#x27;ll learn how assertions might be disabled in production code, so you shouldn&#x27;t use them to validate data. You&#x27;ll also learn about a few common pitfalls of assertions in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;code&gt;assert&lt;/code&gt; statement allows you to write &lt;a href=&quot;https://en.wikipedia.org/wiki/Sanity_check&quot;&gt;sanity checks&lt;/a&gt; in your code. These checks are known as &lt;strong&gt;assertions&lt;/strong&gt;, and you can use them to test if certain assumptions remain true while you’re developing your code. If any of your assertions turn false, then you have a bug in your code.&lt;/p&gt;
&lt;p&gt;Assertions are a convenient tool for &lt;strong&gt;documenting&lt;/strong&gt;, &lt;strong&gt;debugging&lt;/strong&gt;, and &lt;strong&gt;testing&lt;/strong&gt; code during development. Once you’ve debugged and tested your code with the help of assertions, then you can turn them off to optimize the code for production. Assertions will help you make your code more efficient, robust, and reliable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;assertions&lt;/strong&gt; are and when to use them&lt;/li&gt;
&lt;li&gt;How Python’s &lt;strong&gt;&lt;code&gt;assert&lt;/code&gt; statement&lt;/strong&gt; works&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;assert&lt;/code&gt; can help you &lt;strong&gt;document&lt;/strong&gt;, &lt;strong&gt;debug&lt;/strong&gt;, and &lt;strong&gt;test&lt;/strong&gt; your code&lt;/li&gt;
&lt;li&gt;How assertions can be &lt;strong&gt;disabled&lt;/strong&gt; to improve performance in production&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;common pitfalls&lt;/strong&gt; you might face when using &lt;code&gt;assert&lt;/code&gt; statements&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have previous knowledge of &lt;a href=&quot;https://realpython.com/python-operators-expressions/&quot;&gt;expressions and operators&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, &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-exceptions/&quot;&gt;exceptions&lt;/a&gt;. Having a basic understanding of &lt;a href=&quot;https://realpython.com/documenting-python-code/&quot;&gt;documenting&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-debugging-pdb/&quot;&gt;debugging&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;testing&lt;/a&gt; Python code is also a plus.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-tricks-sample-pdf/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-tricks-sample-pdf&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python’s best practices with simple examples you can apply instantly to write more beautiful + Pythonic code.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;getting-to-know-assertions-in-python&quot;&gt;Getting to Know Assertions in Python&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-assertions-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python implements a feature called &lt;a href=&quot;https://en.wikipedia.org/wiki/Assertion_(software_development)&quot;&gt;assertions&lt;/a&gt; that’s pretty useful during the development of your applications and projects. You’ll find this feature in several other languages too, such as &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt;, and it comes in handy for &lt;a href=&quot;https://realpython.com/documenting-python-code/&quot;&gt;documenting&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-debugging-pdb/&quot;&gt;debugging&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;testing&lt;/a&gt; your code.&lt;/p&gt;
&lt;p&gt;If you’re looking for a tool to strengthen your debugging and testing process, then assertions are for you. In this section, you’ll learn the basics of assertions, including what they are, what they’re good for, and when you shouldn’t use them in your code.&lt;/p&gt;
&lt;h3 id=&quot;what-are-assertions&quot;&gt;What Are Assertions?&lt;a class=&quot;headerlink&quot; href=&quot;#what-are-assertions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In Python, assertions are &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-statement&quot;&gt;statements&lt;/a&gt; that you can use to set &lt;strong&gt;sanity checks&lt;/strong&gt; during the development process. Assertions allow you to test the correctness of your code by checking if some specific conditions remain true, which can come in handy while you’re debugging code.&lt;/p&gt;
&lt;p&gt;The assertion condition should always be true unless you have a bug in your program. If the condition turns out to be false, then the assertion raises an exception and terminates the execution of your program.&lt;/p&gt;
&lt;p&gt;With assertions, you can set checks to make sure that &lt;a href=&quot;https://en.wikipedia.org/wiki/Invariant_(mathematics)#Invariants_in_computer_science&quot;&gt;invariants&lt;/a&gt; within your code stay invariant. By doing so, you can check assumptions like &lt;a href=&quot;https://en.wikipedia.org/wiki/Precondition&quot;&gt;preconditions&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Postcondition&quot;&gt;postconditions&lt;/a&gt;. For example, you can test conditions along the lines of &lt;em&gt;This argument is not &lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;&lt;code&gt;None&lt;/code&gt;&lt;/a&gt;&lt;/em&gt; or &lt;em&gt;This return value is a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;&lt;/em&gt;. These kinds of checks can help you catch errors as soon as possible when you’re developing a program.&lt;/p&gt;
&lt;h3 id=&quot;what-are-assertions-good-for&quot;&gt;What Are Assertions Good For?&lt;a class=&quot;headerlink&quot; href=&quot;#what-are-assertions-good-for&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Assertions are mainly for debugging. They’ll help you ensure that you don’t introduce new bugs while adding features and fixing other bugs in your code. However, they can have other interesting use cases within your development process. These use cases include documenting and testing your code.&lt;/p&gt;
&lt;p&gt;The primary role of assertions is to trigger the alarms when a bug appears in a program. In this context, assertions mean &lt;em&gt;Make sure that this condition remains true. Otherwise, throw an error.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In practice, you can use assertions to check preconditions and postconditions in your programs at development time. For example, programmers often place assertions at the beginning of functions to check if the input is valid (preconditions). Programmers also place assertions before functions’ &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;return values&lt;/a&gt; to check if the output is valid (postconditions).&lt;/p&gt;
&lt;p&gt;Assertions make it clear that you want to check if a given condition is and remains true. In Python, they can also include an optional message to unambiguously describe the error or problem at hand. That’s why they’re also an efficient tool for documenting code. In this context, their main advantage is their ability to take concrete action instead of being passive, as &lt;a href=&quot;https://realpython.com/python-comments-guide/&quot;&gt;comments&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/documenting-python-code/#documenting-your-python-code-base-using-docstrings&quot;&gt;docstrings&lt;/a&gt; are.&lt;/p&gt;
&lt;p&gt;Finally, assertions are also ideal for writing &lt;a href=&quot;https://en.wikipedia.org/wiki/Test_case&quot;&gt;test cases&lt;/a&gt; in your code. You can write concise and to-the-point test cases because assertions provide a quick way to check if a given condition is met or not, which defines if the test passes or not.&lt;/p&gt;
&lt;p&gt;You’ll learn more about these common use cases of assertions later in this tutorial. Now you’ll learn the basics of when you &lt;em&gt;shouldn’t&lt;/em&gt; use assertions.&lt;/p&gt;
&lt;h3 id=&quot;when-not-to-use-assertions&quot;&gt;When Not to Use Assertions?&lt;a class=&quot;headerlink&quot; href=&quot;#when-not-to-use-assertions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In general, you shouldn’t use assertions for &lt;strong&gt;data processing&lt;/strong&gt; or &lt;strong&gt;data validation&lt;/strong&gt;, because you can disable assertions in your production code, which ends up removing all your assertion-based processing and validation code. Using assertions for data processing and validation is a common pitfall, as you’ll learn in &lt;a href=&quot;#understanding-common-pitfalls-of-assert&quot;&gt;Understanding Common Pitfalls of &lt;code&gt;assert&lt;/code&gt;&lt;/a&gt; later in this tutorial.&lt;/p&gt;
&lt;p&gt;Additionally, assertions aren’t an &lt;strong&gt;error-handling&lt;/strong&gt; tool. The ultimate purpose of assertions isn’t to handle errors in production but to notify you during development so that you can fix them. In this regard, you shouldn’t write code that catches assertion errors using a regular &lt;a href=&quot;https://realpython.com/python-exceptions/#the-try-and-except-block-handling-exceptions&quot;&gt;&lt;code&gt;try&lt;/code&gt; … &lt;code&gt;except&lt;/code&gt;&lt;/a&gt; statement.&lt;/p&gt;
&lt;h2 id=&quot;understanding-pythons-assert-statements&quot;&gt;Understanding Python’s &lt;code&gt;assert&lt;/code&gt; Statements&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-pythons-assert-statements&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now you know what assertions are, what they’re good for, and when you shouldn’t use them in your code. It’s time to learn the basics of writing your own assertions. First, note that Python implements assertions as a statement with the &lt;code&gt;assert&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-keywords/&quot;&gt;keyword&lt;/a&gt; rather than as a &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&lt;/a&gt;. This behavior can be a common source of confusion and issues, as you’ll learn later in this tutorial.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-assert-statement/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-assert-statement/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Starting With Linear Regression in Python</title>
      <id>https://realpython.com/courses/python-linear-regression/</id>
      <link href="https://realpython.com/courses/python-linear-regression/"/>
      <updated>2022-02-22T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll get started with linear regression in Python. Linear regression is one of the fundamental statistical and machine learning techniques, and Python is a popular choice for machine learning.</summary>
      <content type="html">
        &lt;p&gt;We&amp;rsquo;re living in the era of large amounts of &lt;a href=&quot;https://realpython.com/tutorials/data-science/&quot;&gt;data&lt;/a&gt;, powerful computers, and &lt;a href=&quot;https://realpython.com/python-ai-neural-network/&quot;&gt;artificial intelligence&lt;/a&gt;. This is just the beginning. &lt;a href=&quot;https://realpython.com/data-science-podcasts/&quot;&gt;Data science&lt;/a&gt; and machine learning are driving image recognition, autonomous vehicle development, decisions in the financial and energy sectors, advances in medicine, the rise of social networks, and more. Linear regression is an important part of this.&lt;/p&gt;
&lt;p&gt;Linear regression is one of the fundamental statistical and machine learning techniques. Whether you want to do &lt;a href=&quot;https://realpython.com/python-statistics/&quot;&gt;statistics&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/tutorials/machine-learning/&quot;&gt;machine learning&lt;/a&gt;, or scientific computing, there&amp;rsquo;s a good chance that you&amp;rsquo;ll need it. It&amp;rsquo;s advisable to learn it first and then proceed toward more complex methods.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What linear regression is&lt;/li&gt;
&lt;li&gt;What linear regression is used for&lt;/li&gt;
&lt;li&gt;How linear regression works&lt;/li&gt;
&lt;li&gt;How to implement linear regression in Python, step by step&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>Socket Programming in Python (Guide)</title>
      <id>https://realpython.com/python-sockets/</id>
      <link href="https://realpython.com/python-sockets/"/>
      <updated>2022-02-21T14:00:00+00:00</updated>
      <summary>In this in-depth tutorial, you&#x27;ll learn how to build a socket server and client with Python. By the end of this tutorial, you&#x27;ll understand how to use the main functions and methods in Python&#x27;s socket module to write your own networked client-server applications.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Sockets and the socket API are used to send messages across a network. They provide a form of &lt;a href=&quot;https://en.wikipedia.org/wiki/Inter-process_communication&quot;&gt;inter-process communication (IPC)&lt;/a&gt;. The network can be a logical, local network to the computer, or one that’s physically connected to an external network, with its own connections to other networks. The obvious example is the Internet, which you connect to via your ISP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll create:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A simple &lt;strong&gt;socket server and client&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;An improved version that handles &lt;strong&gt;multiple connections&lt;/strong&gt; simultaneously&lt;/li&gt;
&lt;li&gt;A server-client application that functions like a full-fledged &lt;strong&gt;socket application&lt;/strong&gt;, complete with its own &lt;strong&gt;custom header and content&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end of this tutorial, you’ll understand how to use the main functions and methods in Python’s &lt;a href=&quot;https://docs.python.org/3/library/socket.html&quot;&gt;socket module&lt;/a&gt; to write your own client-server applications. You’ll know how to use a custom class to send messages and data between endpoints, which you can build upon and utilize for your own applications.&lt;/p&gt;
&lt;p&gt;The examples in this tutorial require Python 3.6 or above, and have been tested using Python 3.10. To get the most out of this tutorial, it’s best to download the source code and have it on hand for reference while reading:&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-sockets-source-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-sockets-source-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; for the examples in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Networking and sockets are large subjects. Literal volumes have been written about them. If you’re new to sockets or networking, it’s completely normal if you feel overwhelmed with all of the terms and pieces.&lt;/p&gt;
&lt;p&gt;Don’t be discouraged though. This tutorial is for you! As with anything Python-related, you can learn a little bit at a time. &lt;a href=&quot;https://realpython.com/article-bookmarks-search-improvements/&quot;&gt;Bookmark&lt;/a&gt; this article and come back when you’re ready for the next section.&lt;/p&gt;
&lt;h2 id=&quot;background&quot;&gt;Background&lt;a class=&quot;headerlink&quot; href=&quot;#background&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Sockets have a long history. Their use &lt;a href=&quot;https://en.wikipedia.org/wiki/Network_socket#History&quot;&gt;originated with ARPANET&lt;/a&gt; in 1971 and later became an API in the Berkeley Software Distribution (BSD) operating system released in 1983 called &lt;a href=&quot;https://en.wikipedia.org/wiki/Berkeley_sockets&quot;&gt;Berkeley sockets&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When the Internet took off in the 1990s with the World Wide Web, so did network programming. Web servers and browsers weren’t the only applications taking advantage of newly connected networks and using sockets. Client-server applications of all types and sizes came into widespread use.&lt;/p&gt;
&lt;p&gt;Today, although the underlying protocols used by the socket API have evolved over the years, and new ones have developed, the low-level API has remained the same.&lt;/p&gt;
&lt;p&gt;The most common type of socket applications are client-server applications, where one side acts as the server and waits for connections from clients. This is the type of application that you’ll be creating in this tutorial. More specifically, you’ll focus on the socket API for &lt;a href=&quot;https://en.wikipedia.org/wiki/Berkeley_sockets&quot;&gt;Internet sockets&lt;/a&gt;, sometimes called Berkeley or BSD sockets. There are also &lt;a href=&quot;https://en.wikipedia.org/wiki/Unix_domain_socket&quot;&gt;Unix domain sockets&lt;/a&gt;, which can only be used to communicate between processes on the same host.&lt;/p&gt;
&lt;h2 id=&quot;socket-api-overview&quot;&gt;Socket API Overview&lt;a class=&quot;headerlink&quot; href=&quot;#socket-api-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python’s &lt;a href=&quot;https://docs.python.org/3/library/socket.html&quot;&gt;socket module&lt;/a&gt; provides an interface to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Berkeley_sockets&quot;&gt;Berkeley sockets API&lt;/a&gt;. This is the module that you’ll use in this tutorial.&lt;/p&gt;
&lt;p&gt;The primary socket API functions and methods in this module are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;socket()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.bind()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.listen()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.accept()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.connect()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.connect_ex()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.send()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.recv()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.close()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Python provides a convenient and consistent API that maps directly to system calls, their C counterparts. In the next section, you’ll learn how these are used together.&lt;/p&gt;
&lt;p&gt;As part of its standard library, Python also has classes that make using these low-level socket functions easier. Although it’s not covered in this tutorial, you can check out the &lt;a href=&quot;https://docs.python.org/3/library/socketserver.html&quot;&gt;socketserver module&lt;/a&gt;, a framework for network servers. There are also many modules available that implement higher-level Internet protocols like HTTP and SMTP. For an overview, see &lt;a href=&quot;https://docs.python.org/3/library/internet.html&quot;&gt;Internet Protocols and Support&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;tcp-sockets&quot;&gt;TCP Sockets&lt;a class=&quot;headerlink&quot; href=&quot;#tcp-sockets&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’re going to create a socket object using &lt;code&gt;socket.socket()&lt;/code&gt;, specifying the socket type as &lt;code&gt;socket.SOCK_STREAM&lt;/code&gt;. When you do that, the default protocol that’s used is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Transmission_Control_Protocol&quot;&gt;Transmission Control Protocol (TCP)&lt;/a&gt;. This is a good default and probably what you want.&lt;/p&gt;
&lt;p&gt;Why should you use TCP? The Transmission Control Protocol (TCP):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Is reliable:&lt;/strong&gt; Packets dropped in the network are detected and retransmitted by the sender.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Has in-order data delivery:&lt;/strong&gt; Data is read by your application in the order it was written by the sender.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In contrast, &lt;a href=&quot;https://en.wikipedia.org/wiki/User_Datagram_Protocol&quot;&gt;User Datagram Protocol (UDP)&lt;/a&gt; sockets created with &lt;code&gt;socket.SOCK_DGRAM&lt;/code&gt; aren’t reliable, and data read by the receiver can be out-of-order from the sender’s writes.&lt;/p&gt;
&lt;p&gt;Why is this important? Networks are a best-effort delivery system. There’s no guarantee that your data will reach its destination or that you’ll receive what’s been sent to you.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-sockets/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-sockets/ »&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 #98: Drawing Fractals With Python and Working With a Weather API</title>
      <id>https://realpython.com/podcasts/rpp/98/</id>
      <link href="https://realpython.com/podcasts/rpp/98/"/>
      <updated>2022-02-18T12:00:00+00:00</updated>
      <summary>Have you been wanting to explore fractals and complex numbers in Python? Would you like to practice working with APIs in Python through a new project? This week on the show, Christopher Trudeau is here, and he&#x27;s taking on the task of curating new issues of PyCoder&#x27;s Weekly going forward. He&#x27;ll be joining me as a cohost every other week and bringing a fresh batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you been wanting to explore fractals and complex numbers in Python? Would you like to practice working with APIs in Python through a new project? This week on the show, Christopher Trudeau is here, and he&#x27;s taking on the task of curating new issues of PyCoder&#x27;s Weekly going forward. He&#x27;ll be joining me as a cohost every other week and bringing a fresh batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Providing Multiple Constructors in Your Python Classes</title>
      <id>https://realpython.com/python-multiple-constructors/</id>
      <link href="https://realpython.com/python-multiple-constructors/"/>
      <updated>2022-02-16T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to provide multiple constructors in your Python classes. To this end, you&#x27;ll learn different techniques, such as checking argument types, using default argument values, writing class methods, and implementing single-dispatch methods.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Sometimes you need to write a Python class that provides multiple ways to construct objects. In other words, you want a class that implements &lt;strong&gt;multiple constructors&lt;/strong&gt;. This kind of class comes in handy when you need to create instances using different types or numbers of arguments. Having the tools to provide multiple constructors will help you write flexible classes that can adapt to changing needs.&lt;/p&gt;
&lt;p&gt;In Python, there are several techniques and tools that you can use to construct classes, including simulating multiple constructors through optional arguments, customizing instance creation via class methods, and doing special dispatch with decorators. If you want to learn about these techniques and tools, then this tutorial is for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;optional arguments&lt;/strong&gt; and &lt;strong&gt;type checking&lt;/strong&gt; to simulate multiple constructors&lt;/li&gt;
&lt;li&gt;Write multiple constructors using the built-in &lt;strong&gt;&lt;code&gt;@classmethod&lt;/code&gt;&lt;/strong&gt; decorator&lt;/li&gt;
&lt;li&gt;Overload your class constructors using the &lt;strong&gt;&lt;code&gt;@singledispatchmethod&lt;/code&gt;&lt;/strong&gt; decorator&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also get a peek under the hood at how Python internally &lt;strong&gt;constructs instances&lt;/strong&gt; of a regular class and how some &lt;strong&gt;standard-library classes&lt;/strong&gt; provide multiple constructors.&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should have basic knowledge of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; and understand how to define &lt;a href=&quot;https://realpython.com/instance-class-and-static-methods-demystified/&quot;&gt;class methods&lt;/a&gt; with &lt;code&gt;@classmethod&lt;/code&gt;. You should also have experience working with &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt; in Python.&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-oop/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-oop&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get access to a free Python OOP Cheat Sheet&lt;/a&gt; that points you to the best tutorials, videos, and books to learn more about Object-Oriented Programming with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;instantiating-classes-in-python&quot;&gt;Instantiating Classes in Python&lt;a class=&quot;headerlink&quot; href=&quot;#instantiating-classes-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python supports &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; with &lt;strong&gt;classes&lt;/strong&gt; that are straightforward to create and use. Python classes offer powerful features that can help you write better software. Classes are like blueprints for &lt;strong&gt;objects&lt;/strong&gt;, also known as &lt;strong&gt;instances&lt;/strong&gt;. In the same way that you can build several houses from a single blueprint, you can build several instances from a class.&lt;/p&gt;
&lt;p&gt;To define a class in Python, you need to use the &lt;a href=&quot;https://realpython.com/python-keywords/#structure-keywords-def-class-with-as-pass-lambda&quot;&gt;&lt;code&gt;class&lt;/code&gt;&lt;/a&gt; keyword followed by the class name:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Define a Person class&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fm&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Python has a rich set of &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-special-method&quot;&gt;special methods&lt;/a&gt; that you can use in your classes. Python implicitly calls special methods to automatically execute a wide variety of operations on instances. There are special methods to make your objects iterable, provide a suitable string representation for your objects, initialize instance attributes, and a lot more.&lt;/p&gt;
&lt;p&gt;A pretty common special method is &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__init__&quot;&gt;&lt;code&gt;.__init__()&lt;/code&gt;&lt;/a&gt;. This method provides what’s known as the &lt;strong&gt;instance initializer&lt;/strong&gt; in Python. This method’s job is to initialize &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#class-and-instance-attributes&quot;&gt;instance attributes&lt;/a&gt; with appropriate values when you instantiate a given class.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;Person&lt;/code&gt;, the &lt;code&gt;.__init__()&lt;/code&gt; method’s first argument is called &lt;code&gt;self&lt;/code&gt;. This argument holds the current object or instance, which is passed implicitly in the method call. This argument is common to every &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#instance-methods&quot;&gt;instance method&lt;/a&gt; in Python. The second argument to &lt;code&gt;.__init__()&lt;/code&gt; is called &lt;code&gt;name&lt;/code&gt; and will hold the person’s name as a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Using &lt;a href=&quot;https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments&quot;&gt;&lt;code&gt;self&lt;/code&gt;&lt;/a&gt; to name the current object is a pretty strong convention in Python but not a requirement. However, using another name will raise some eyebrows among your fellow Python developers.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Once you’ve defined a class, you can start &lt;strong&gt;instantiating&lt;/strong&gt; it. In other words, you can start creating objects of that class. To do this, you’ll use a familiar syntax. Just call the class using a pair of parentheses (&lt;code&gt;()&lt;/code&gt;), which is the same syntax that you use to call any Python &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&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;c1&quot;&gt;# Instantiating Person&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;john&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;John Doe&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;john&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;John Doe&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In Python, the class name provides what other languages, such as &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt;, call the &lt;strong&gt;class constructor&lt;/strong&gt;. Calling a class, like you did with &lt;code&gt;Person&lt;/code&gt;, triggers Python’s class &lt;strong&gt;instantiation process&lt;/strong&gt;, which internally runs in two steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; a new instance of the target class.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Initialize&lt;/strong&gt; the instance with suitable instance attribute values.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To continue with the above example, the value that you pass as an argument to &lt;code&gt;Person&lt;/code&gt; is internally passed to &lt;code&gt;.__init__()&lt;/code&gt; and then assigned to the instance attribute &lt;code&gt;.name&lt;/code&gt;. This way, you initialize your person instance, &lt;code&gt;john&lt;/code&gt;, with valid data, which you can confirm by accessing &lt;code&gt;.name&lt;/code&gt;. Success! &lt;code&gt;John Doe&lt;/code&gt; is indeed his name.&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; When you call the class to create a new instance, you need to provide as many arguments as &lt;code&gt;.__init__()&lt;/code&gt; requires so that this method can initialize all the instance attributes that demand an initial value.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now that you understand the object initialization mechanism, you’re ready to learn what Python does before it gets to this point in the instantiation process. It’s time to dig into another special method, called &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__new__&quot;&gt;&lt;code&gt;.__new__()&lt;/code&gt;&lt;/a&gt;. This method takes care of creating new instances in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;.__new__()&lt;/code&gt; special method is often called a &lt;strong&gt;class constructor&lt;/strong&gt; in Python. However, its job is actually to create new objects from the class blueprint, so you can more accurately call it an &lt;strong&gt;instance creator&lt;/strong&gt; or &lt;strong&gt;object creator&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;.__new__()&lt;/code&gt; special method takes the underlying class as its first argument and returns a new object. This object is typically an instance of the input class, but in some cases, it can be an instance of a different class.&lt;/p&gt;
&lt;p&gt;If the object that &lt;code&gt;.__new__()&lt;/code&gt; returns is an instance of the current class, then this instance is immediately passed to &lt;code&gt;.__init__()&lt;/code&gt; for initialization purposes. These two steps run when you call the class.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-multiple-constructors/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-multiple-constructors/ »&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 any(): Powered Up Boolean Function</title>
      <id>https://realpython.com/courses/python-any-boolean-function/</id>
      <link href="https://realpython.com/courses/python-any-boolean-function/"/>
      <updated>2022-02-15T14:00:00+00:00</updated>
      <summary>If you&#x27;ve ever wondered how to simplify complex conditionals by determining if at least one in a series of conditions is true, then look no further. This video course will teach you all about how to use any() in Python to do just that.</summary>
      <content type="html">
        &lt;p&gt;As a Python programmer, you&amp;rsquo;ll frequently deal with &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Booleans&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;&amp;mdash;sometimes very complex ones. In those situations, you may need to rely on tools that can simplify logic and consolidate information. Fortunately,  &lt;strong&gt;&lt;code&gt;any()&lt;/code&gt;&lt;/strong&gt; in Python is such a tool. It looks through the elements in an iterable and returns a single value indicating whether any element is true in a Boolean context, or &lt;strong&gt;truthy.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;any()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;not any()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Elimate long &lt;strong&gt;&lt;code&gt;or&lt;/code&gt; chains&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;any()&lt;/code&gt; with &lt;strong&gt;list comprehensions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Evalute values&lt;/strong&gt; that aren&amp;rsquo;t explicitly &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Distinguish between &lt;strong&gt;&lt;code&gt;any()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;or&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;short-circuiting&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 zipfile: Manipulate Your ZIP Files Efficiently</title>
      <id>https://realpython.com/python-zipfile/</id>
      <link href="https://realpython.com/python-zipfile/"/>
      <updated>2022-02-14T14:00:00+00:00</updated>
      <summary>In this guided tutorial, you&#x27;ll learn how to manipulate ZIP files using Python&#x27;s zipfile module from the standard library. Through hands-on examples, you&#x27;ll learn how to read, write, compress, and extract files from your ZIP files quickly.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;a href=&quot;https://docs.python.org/3/library/zipfile.html&quot;&gt;&lt;code&gt;zipfile&lt;/code&gt;&lt;/a&gt; is a standard library module intended to manipulate &lt;strong&gt;ZIP files&lt;/strong&gt;. This file format is a widely adopted industry standard when it comes to archiving and compressing digital data. You can use it to package together several related files. It also allows you to reduce the size of your files and save disk space. Most importantly, it facilitates data exchange over computer networks.&lt;/p&gt;
&lt;p&gt;Knowing how to create, read, write, populate, extract, and list ZIP files using the &lt;code&gt;zipfile&lt;/code&gt; module is a useful skill to have as a Python developer or a DevOps engineer.&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;Read, write, and extract&lt;/strong&gt; files from ZIP files with Python’s &lt;code&gt;zipfile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Read &lt;strong&gt;metadata&lt;/strong&gt; about the content of ZIP files using &lt;code&gt;zipfile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;zipfile&lt;/code&gt; to &lt;strong&gt;manipulate member files&lt;/strong&gt; in existing ZIP files&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;new ZIP files&lt;/strong&gt; to archive and compress files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you commonly deal with ZIP files, then this knowledge can help to streamline your workflow to process your files confidently.&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should know the basics of &lt;a href=&quot;https://realpython.com/working-with-files-in-python/&quot;&gt;working with files&lt;/a&gt;, using the &lt;a href=&quot;https://realpython.com/python-with-statement/&quot;&gt;&lt;code&gt;with&lt;/code&gt; statement&lt;/a&gt;, handling file system paths with &lt;a href=&quot;https://realpython.com/python-pathlib/&quot;&gt;&lt;code&gt;pathlib&lt;/code&gt;&lt;/a&gt;, and working with classes and &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To get the files and archives that you’ll use to code the examples in this tutorial, click the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Materials:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-zipfile-materials/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-zipfile-materials&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get a copy of the files and archives&lt;/a&gt; that you’ll use to run the examples in this zipfile tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;getting-started-with-zip-files&quot;&gt;Getting Started With ZIP Files&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-zip-files&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;ZIP files&lt;/strong&gt; are a well-known and popular tool in today’s digital world. These files are fairly popular and widely used for cross-platform data exchange over computer networks, notably the Internet.&lt;/p&gt;
&lt;p&gt;You can use ZIP files for bundling regular files together into a single archive, compressing your data to save some disk space, distributing your digital products, and more. In this tutorial, you’ll learn how to manipulate ZIP files using Python’s &lt;code&gt;zipfile&lt;/code&gt; module.&lt;/p&gt;
&lt;p&gt;Because the terminology around ZIP files can be confusing at times, this tutorial will stick to the following conventions regarding terminology:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Term&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ZIP file, ZIP archive, or archive&lt;/td&gt;
&lt;td&gt;A physical file that uses the &lt;a href=&quot;https://en.wikipedia.org/wiki/ZIP_(file_format)&quot;&gt;ZIP file format&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File&lt;/td&gt;
&lt;td&gt;A regular &lt;a href=&quot;https://en.wikipedia.org/wiki/Computer_file&quot;&gt;computer file&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Member file&lt;/td&gt;
&lt;td&gt;A file that is part of an existing ZIP file&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Having these terms clear in your mind will help you avoid confusion while you read through the upcoming sections. Now you’re ready to continue learning how to manipulate ZIP files efficiently in your Python code!&lt;/p&gt;
&lt;h3 id=&quot;what-is-a-zip-file&quot;&gt;What Is a ZIP File?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-a-zip-file&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You’ve probably already encountered and worked with ZIP files. Yes, those with the &lt;code&gt;.zip&lt;/code&gt; file extension are everywhere! ZIP files, also known as &lt;strong&gt;ZIP archives&lt;/strong&gt;, are files that use the &lt;strong&gt;ZIP file format&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/PKWARE,_Inc.&quot;&gt;PKWARE&lt;/a&gt; is the company that created and first implemented this file format. The company put together and maintains the current &lt;a href=&quot;https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT&quot;&gt;format specification&lt;/a&gt;, which is publicly available and allows the creation of products, programs, and processes that read and write files using the ZIP file format.&lt;/p&gt;
&lt;p&gt;The ZIP file format is a cross-platform, interoperable file storage and transfer format. It combines &lt;a href=&quot;https://en.wikipedia.org/wiki/Lossless_compression&quot;&gt;lossless data compression&lt;/a&gt;, file management, and data &lt;a href=&quot;https://en.wikipedia.org/wiki/Encryption&quot;&gt;encryption&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Data compression isn’t a requirement for an archive to be considered a ZIP file. So you can have compressed or uncompressed member files in your ZIP archives. The ZIP file format supports several compression algorithms, though &lt;a href=&quot;https://en.wikipedia.org/wiki/Deflate&quot;&gt;Deflate&lt;/a&gt; is the most common. The format also supports information integrity checks with &lt;a href=&quot;https://en.wikipedia.org/wiki/Cyclic_redundancy_check&quot;&gt;CRC32&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Even though there are other similar archiving formats, such as &lt;a href=&quot;https://en.wikipedia.org/wiki/RAR_(file_format)&quot;&gt;RAR&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Tar_(computing)#File_format&quot;&gt;TAR&lt;/a&gt; files, the ZIP file format has quickly become a common standard for efficient data storage and for data exchange over computer networks.&lt;/p&gt;
&lt;p&gt;ZIP files are everywhere. For example, office suites such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Microsoft_Office&quot;&gt;Microsoft Office&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/LibreOffice&quot;&gt;Libre Office&lt;/a&gt; rely on the ZIP file format as their &lt;a href=&quot;https://www.iso.org/standard/60101.html&quot;&gt;document container file&lt;/a&gt;. This means that &lt;code&gt;.docx&lt;/code&gt;, &lt;code&gt;.xlsx&lt;/code&gt;, &lt;code&gt;.pptx&lt;/code&gt;, &lt;code&gt;.odt&lt;/code&gt;, &lt;code&gt;.ods&lt;/code&gt;, &lt;code&gt;.odp&lt;/code&gt; files are actually ZIP archives containing several files and folders that make up each document. Other common files that use the ZIP format include &lt;a href=&quot;https://en.wikipedia.org/wiki/JAR_(file_format)&quot;&gt;&lt;code&gt;.jar&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/WAR_(file_format)&quot;&gt;&lt;code&gt;.war&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/EPUB&quot;&gt;&lt;code&gt;.epub&lt;/code&gt;&lt;/a&gt; files.&lt;/p&gt;
&lt;p&gt;You may be familiar with &lt;a href=&quot;https://realpython.com/python-git-github-intro/&quot;&gt;GitHub&lt;/a&gt;, which provides web hosting for software development and &lt;a href=&quot;https://en.wikipedia.org/wiki/Version_control&quot;&gt;version control&lt;/a&gt; using &lt;a href=&quot;https://realpython.com/advanced-git-for-pythonistas/&quot;&gt;Git&lt;/a&gt;. GitHub uses ZIP files to package software projects when you download them to your local computer. For example, you can download the &lt;a href=&quot;https://github.com/realpython/python-basics-exercises/archive/refs/heads/master.zip&quot;&gt;exercise solutions&lt;/a&gt; for &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt; book in a ZIP file, or you can download any other project of your choice.&lt;/p&gt;
&lt;p&gt;ZIP files allow you to aggregate, compress, and encrypt files into a single interoperable and portable container. You can stream ZIP files, split them into segments, make them self-extracting, and more.&lt;/p&gt;
&lt;h3 id=&quot;why-use-zip-files&quot;&gt;Why Use ZIP Files?&lt;a class=&quot;headerlink&quot; href=&quot;#why-use-zip-files&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Knowing how to create, read, write, and extract ZIP files can be a useful skill for developers and professionals who work with computers and digital information. Among other benefits, ZIP files allow you to:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-zipfile/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-zipfile/ »&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 #97: Improving Your Django and Python Developer Experience</title>
      <id>https://realpython.com/podcasts/rpp/97/</id>
      <link href="https://realpython.com/podcasts/rpp/97/"/>
      <updated>2022-02-11T12:00:00+00:00</updated>
      <summary>How often have you thought about your Developer Experience (DX)? How do you improve your workflow, find documentation, and simplify code formatting? This week on the show, Adam Johnson is here to talk about his new book, &quot;Boost Your Django DX.&quot;</summary>
      <content type="html">
        &lt;p&gt;How often have you thought about your Developer Experience (DX)? How do you improve your workflow, find documentation, and simplify code formatting? This week on the show, Adam Johnson is here to talk about his new book, &quot;Boost Your Django DX.&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&#x27;s all(): Check Your Iterables for Truthiness</title>
      <id>https://realpython.com/python-all/</id>
      <link href="https://realpython.com/python-all/"/>
      <updated>2022-02-09T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to use Python&#x27;s all() function to check if all the items in an iterable are truthy. You&#x27;ll also code various examples that showcase a few interesting use cases of all() and highlight how you can use this function in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;When programming, you’ll often need to check if all the items in an iterable are truthy. Coding this functionality repeatedly can be annoying and inefficient. Luckily, Python provides the built-in &lt;code&gt;all()&lt;/code&gt; function to solve this problem. This function takes an iterable and checks all its items for truth value, which is handy for finding out if those items have a given property or meet a particular condition.&lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;all()&lt;/code&gt; is a powerful tool that can help you write clean, readable, and efficient code in Python.&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;Check if all the items in an iterable are truthy by using &lt;strong&gt;&lt;code&gt;all()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;all()&lt;/code&gt; with different &lt;strong&gt;iterable types&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Combine &lt;code&gt;all()&lt;/code&gt; with &lt;strong&gt;comprehensions&lt;/strong&gt; and &lt;strong&gt;generator expressions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Distinguish between &lt;code&gt;all()&lt;/code&gt; and the Boolean &lt;strong&gt;&lt;code&gt;and&lt;/code&gt; operator&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To complement this knowledge, you’ll code several examples that showcase exciting use cases of &lt;code&gt;all()&lt;/code&gt; and highlight the many ways to use this function in Python programming.&lt;/p&gt;
&lt;p&gt;To understand the topics in this tutorial, you should have basic knowledge of several Python concepts, such as iterable &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structures&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean types&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-operators-expressions/&quot;&gt;expressions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-boolean/#boolean-operators&quot;&gt;operators&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;list comprehensions&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/#building-generators-with-generator-expressions&quot;&gt;generator expressions&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 PDF Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-cheat-sheet-short/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-short&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Python 3 Cheat Sheet&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;evaluating-the-truth-value-of-items-in-iterables&quot;&gt;Evaluating the Truth Value of Items in Iterables&lt;a class=&quot;headerlink&quot; href=&quot;#evaluating-the-truth-value-of-items-in-iterables&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A pretty common problem in programming is determining if all the items in a list or array are truthy or not.  For example, you may have the following list of conditions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;5 &amp;gt; 2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1 == 1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;42 &amp;lt; 50&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To figure out if these conditions are true, you need to iterate over them and test every condition for truthiness. In this example, you have that &lt;code&gt;5 &amp;gt; 2&lt;/code&gt; is true, &lt;code&gt;1 == 1&lt;/code&gt; is true, and &lt;code&gt;42 &amp;lt; 50&lt;/code&gt; is also true. As a result, you can say that &lt;em&gt;all&lt;/em&gt; these conditions are true. If at least one of the conditions were false, then you would say that &lt;em&gt;not all&lt;/em&gt; the conditions are true.&lt;/p&gt;
&lt;p&gt;Note that as soon as you find a falsy condition, you can stop evaluating conditions because, in that case, you already know the final result: &lt;em&gt;not all&lt;/em&gt; are true.&lt;/p&gt;
&lt;p&gt;To solve this problem by writing custom Python code, you can use 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 iterate over each condition and evaluate it for truthiness. Your loop will iterate until it finds a falsy item, at which point it’ll stop because you already have a result:&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iterable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&lt;/a&gt; takes an &lt;strong&gt;iterable&lt;/strong&gt; as an argument. The loop iterates over the input argument while the &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional &lt;code&gt;if&lt;/code&gt; statement&lt;/a&gt; checks if any item is falsy using the &lt;a href=&quot;https://realpython.com/python-not-operator/&quot;&gt;&lt;code&gt;not&lt;/code&gt;&lt;/a&gt; operator. If an item is falsy, then the function immediately &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;returns&lt;/a&gt; &lt;code&gt;False&lt;/code&gt;, signaling that not all the items are true. Otherwise, it returns &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This function is quite generic. It takes an iterable, which means you can pass in a &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list, tuple&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt;, or any other iterable &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structure&lt;/a&gt;. To check if the current item is true or false, &lt;code&gt;all_true()&lt;/code&gt; uses the &lt;code&gt;not&lt;/code&gt; operator to invert the &lt;strong&gt;truth value&lt;/strong&gt; of its operand. In other words, it returns &lt;code&gt;True&lt;/code&gt; if its operand evaluates to false and vice versa.&lt;/p&gt;
&lt;p&gt;Python’s &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean&lt;/a&gt; operators can evaluate the truth value of expressions and objects, which guarantees that your function can take iterables containing objects, expressions, or both. For example, if you pass in an iterable of Boolean expressions, then &lt;code&gt;not&lt;/code&gt; just evaluates the expression and negates the result.&lt;/p&gt;
&lt;p&gt;Here’s &lt;code&gt;all_true()&lt;/code&gt; in action:&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;bool_exps&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bool_exps&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Because all the expressions in the input iterable are true, &lt;code&gt;not&lt;/code&gt; negates the result, and the &lt;code&gt;if&lt;/code&gt; code block never runs. In that case, &lt;code&gt;all_true()&lt;/code&gt; returns &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Something similar happens when the input iterable holds Python objects and non-Boolean expressions:&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;objects&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;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&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;n&quot;&gt;general_expressions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;42&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;general_expressions&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;empty&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;empty&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the first example, the input list contains regular Python objects, including a string, a &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;number&lt;/a&gt;, and a dictionary. In this case, &lt;code&gt;all_true()&lt;/code&gt; returns &lt;code&gt;False&lt;/code&gt; because the dictionary is empty and evaluates to false in Python.&lt;/p&gt;
&lt;p&gt;To perform &lt;a href=&quot;https://docs.python.org/3/library/stdtypes.html#truth-value-testing&quot;&gt;truth value testing&lt;/a&gt; on objects, Python has an internal set of rules for objects that evaluate as false:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Inherently negative constants, like &lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;&lt;code&gt;None&lt;/code&gt;&lt;/a&gt; and &lt;code&gt;False&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Numeric types with a zero value, like  &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;0.0&lt;/code&gt;, &lt;a href=&quot;https://realpython.com/python-complex-numbers/&quot;&gt;&lt;code&gt;0j&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://docs.python.org/3/library/decimal.html#decimal.Decimal&quot;&gt;&lt;code&gt;Decimal(&quot;0&quot;)&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-fractions/&quot;&gt;&lt;code&gt;Fraction(0, 1)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Empty sequences and collections, like  &lt;code&gt;&quot;&quot;&lt;/code&gt;, &lt;code&gt;()&lt;/code&gt;, &lt;code&gt;[]&lt;/code&gt;, &lt;code&gt;{}&lt;/code&gt;, &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;&lt;code&gt;set()&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-range/&quot;&gt;&lt;code&gt;range(0)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Objects that implement &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__bool__&quot;&gt;&lt;code&gt;.__bool__()&lt;/code&gt;&lt;/a&gt; with a return value of &lt;code&gt;False&lt;/code&gt; or &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__len__&quot;&gt;&lt;code&gt;.__len__()&lt;/code&gt;&lt;/a&gt; with a return value of &lt;code&gt;0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-all/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-all/ »&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>Defining Python Functions With Optional Arguments</title>
      <id>https://realpython.com/courses/defining-python-functions-with-optional-arguments/</id>
      <link href="https://realpython.com/courses/defining-python-functions-with-optional-arguments/"/>
      <updated>2022-02-08T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about Python optional arguments and how to define functions with default values. You&#x27;ll also learn how to create functions that accept any number of arguments using args and kwargs.</summary>
      <content type="html">
        &lt;p&gt;Defining your own functions is an essential skill for writing clean and effective code. In this tutorial, you&amp;rsquo;ll explore the techniques you have available for defining Python functions that take optional arguments. When you master Python optional arguments, you&amp;rsquo;ll be able to define functions that are more powerful and more flexible.&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;Distinguish between &lt;strong&gt;parameters&lt;/strong&gt; and &lt;strong&gt;arguments&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Define functions with &lt;strong&gt;optional arguments&lt;/strong&gt; and &lt;strong&gt;default parameter values&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Define functions using &lt;strong&gt;&lt;code&gt;args&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;kwargs&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Deal with &lt;strong&gt;error messages&lt;/strong&gt; about optional arguments&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 News: What&#x27;s New From January 2022?</title>
      <id>https://realpython.com/python-news-january-2022/</id>
      <link href="https://realpython.com/python-news-january-2022/"/>
      <updated>2022-02-07T14:00:00+00:00</updated>
      <summary>In January 2022, Black came out of Beta, IPython 8.0 was released, PEP 665 was rejected, and last but not least, a fifteen-year-old bug was fixed. In this article, you&#x27;ll get the details on these important happenings in the world of Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In &lt;strong&gt;January 2022&lt;/strong&gt;, the code formatter &lt;strong&gt;Black&lt;/strong&gt; saw its first non-beta release and published a new stability policy. &lt;strong&gt;IPython&lt;/strong&gt;, the powerful interactive Python shell, marked the release of &lt;strong&gt;version 8.0&lt;/strong&gt;, its first major version release in three years. Additionally, &lt;strong&gt;PEP 665&lt;/strong&gt;, aimed at making reproducible installs easier by specifying a format for lock files, was rejected. Last but not least, a fifteen-year-old &lt;strong&gt;memory leak&lt;/strong&gt; bug in Python was fixed.&lt;/p&gt;
&lt;p&gt;Let’s dive into the biggest &lt;strong&gt;Python news&lt;/strong&gt; stories 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;black-no-longer-beta&quot;&gt;Black No Longer Beta&lt;a class=&quot;headerlink&quot; href=&quot;#black-no-longer-beta&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The developers of &lt;a href=&quot;https://github.com/psf/black&quot;&gt;Black&lt;/a&gt;, an opinionated code formatter, are now confident enough to call the latest release stable. This announcement brings Black out of beta for the first time:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png&quot; width=&quot;746&quot; height=&quot;409&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png&amp;amp;w=186&amp;amp;sig=dc1ff66d10ed549ae5cdab28a389ccdd98f6324b 186w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png&amp;amp;w=373&amp;amp;sig=4a24ef02afe80e827ecfb79c733ecb0b5e8090fb 373w, https://files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png 746w&quot; sizes=&quot;75vw&quot; alt=&quot;Screenshot of tweet announcing stable release of Black&quot; data-asset=&quot;4195&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;&lt;a href=&quot;https://twitter.com/llanga/status/1487530230512295940?t=OOt8LufaUk0ex6iRgcKk9Q&amp;amp;s=19&quot; target=&quot;_blank&quot;&gt;Image source&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Code formatting can be the source of a surprising amount of conflict among developers. This is why code formatters, or &lt;a href=&quot;https://en.wikipedia.org/wiki/Lint_(software)&quot;&gt;linters&lt;/a&gt;, help enforce style conventions to maintain consistency across a whole codebase. Linters suggest changes, while code formatters rewrite your code:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/ipython-demo-2.e79f3df9cb73.gif&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/ipython-demo-2.e79f3df9cb73.gif&quot; width=&quot;984&quot; height=&quot;382&quot; srcset=&quot;https://files.realpython.com/media/ipython-demo-2.e79f3df9cb73.gif 246w, https://files.realpython.com/media/ipython-demo-2.e79f3df9cb73.gif 492w, https://files.realpython.com/media/ipython-demo-2.e79f3df9cb73.gif 984w&quot; sizes=&quot;75vw&quot; alt=&quot;Demo of Black formatter executing&quot; data-asset=&quot;4194&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;This makes your codebase more consistent, helps catch errors early, and makes code easier to scan.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/google/yapf&quot;&gt;YAPF&lt;/a&gt; is an example of a formatter.  It comes with the &lt;a href=&quot;https://www.python.org/dev/peps/pep-0008/&quot;&gt;PEP 8&lt;/a&gt; style guide as a default, but it’s not strongly opinionated, giving you a lot of control over its configuration.&lt;/p&gt;
&lt;p&gt;Black goes further: it comes with a PEP 8 compliant style, but on the whole, it’s &lt;em&gt;not&lt;/em&gt; configurable. The idea behind disallowing configuration is that you free up your brain to focus on the actual code by relinquishing control over style. Many believe this restriction gives them much more freedom to be creative coders. But of course, not everyone likes to give up this control!&lt;/p&gt;
&lt;p&gt;One crucial feature of opinionated formatters like Black is that they make your &lt;a href=&quot;https://en.wikipedia.org/wiki/Diff&quot;&gt;diffs&lt;/a&gt; much more informative. If you’ve ever committed a &lt;em&gt;cleanup&lt;/em&gt; or &lt;em&gt;formatting&lt;/em&gt; commit to your version control system, you may have inadvertently polluted your diff.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-january-2022/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-january-2022/ »&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 #96: Manipulating and Analyzing Audio in Python</title>
      <id>https://realpython.com/podcasts/rpp/96/</id>
      <link href="https://realpython.com/podcasts/rpp/96/"/>
      <updated>2022-02-04T12:00:00+00:00</updated>
      <summary>Would you like to experiment with analyzing or manipulating audio with Python? This week on the show, we have Braden Riggs from DolbyIO to discuss extracting audio features and Python libraries for reshaping audio. Braden shares techniques from his recent talk at PyData Global, &quot;Unlocking More From Your Audio Data!&quot;</summary>
      <content type="html">
        &lt;p&gt;Would you like to experiment with analyzing or manipulating audio with Python? This week on the show, we have Braden Riggs from DolbyIO to discuss extracting audio features and Python libraries for reshaping audio. Braden shares techniques from his recent talk at PyData Global, &quot;Unlocking More From Your Audio Data!&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 Python&#x27;s pip to Manage Your Projects&#x27; Dependencies</title>
      <id>https://realpython.com/what-is-pip/</id>
      <link href="https://realpython.com/what-is-pip/"/>
      <updated>2022-02-02T14:00:00+00:00</updated>
      <summary>What is pip? In this beginner-friendly tutorial, you&#x27;ll learn how to use pip, the standard package manager for Python, so that you can install and manage packages that aren&#x27;t part of the Python standard library.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The standard package manager for &lt;a href=&quot;https://www.python.org/&quot;&gt;Python&lt;/a&gt; is &lt;a href=&quot;https://pip.pypa.io/en/stable/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. It allows you to install and manage packages that aren’t part of the &lt;a href=&quot;https://docs.python.org/3/py-modindex.html&quot;&gt;Python standard library&lt;/a&gt;. If you’re looking for an introduction to &lt;code&gt;pip&lt;/code&gt;, then you’ve come to the right place!&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;Set up &lt;code&gt;pip&lt;/code&gt;&lt;/strong&gt; in your working environment&lt;/li&gt;
&lt;li&gt;Fix &lt;strong&gt;common errors&lt;/strong&gt; related to working with &lt;code&gt;pip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Install and uninstall packages&lt;/strong&gt; with &lt;code&gt;pip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Manage projects’ dependencies using &lt;strong&gt;requirements files&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can do a lot with &lt;code&gt;pip&lt;/code&gt;, but the Python community is very active and has created some neat alternatives to &lt;code&gt;pip&lt;/code&gt;. You’ll learn about those later in this tutorial.&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;getting-started-with-pip&quot;&gt;Getting Started With &lt;code&gt;pip&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pip&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So, what exactly does &lt;code&gt;pip&lt;/code&gt; do? &lt;a href=&quot;https://pip.pypa.io/en/stable/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; is a &lt;strong&gt;package manager&lt;/strong&gt; for Python. That means it’s a tool that allows you to install and manage libraries and dependencies that aren’t distributed as part of the standard library. The name &lt;strong&gt;pip&lt;/strong&gt; was introduced by Ian Bicking in 2008:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I’ve finished renaming pyinstall to its new name: pip. The name pip is [an] acronym and declaration: pip installs packages. (&lt;a href=&quot;https://www.ianbicking.org/blog/2008/10/pyinstall-is-dead-long-live-pip.html&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Package management is so important that Python’s installers have included &lt;code&gt;pip&lt;/code&gt; since versions 3.4 and 2.7.9, for Python 3 and Python 2, respectively. Many Python projects use &lt;code&gt;pip&lt;/code&gt;, which makes it an essential tool for every Pythonista.&lt;/p&gt;
&lt;p&gt;The concept of a package manager might be familiar to you if you’re coming from another programming language. &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript&quot;&gt;JavaScript&lt;/a&gt; uses &lt;a href=&quot;https://www.npmjs.com/&quot;&gt;npm&lt;/a&gt; for package management, &lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt; uses &lt;a href=&quot;https://rubygems.org/&quot;&gt;gem&lt;/a&gt;, and the &lt;a href=&quot;https://dotnet.microsoft.com/languages&quot;&gt;.NET platform&lt;/a&gt; uses &lt;a href=&quot;https://www.nuget.org/&quot;&gt;NuGet&lt;/a&gt;. In Python, &lt;code&gt;pip&lt;/code&gt; has become the standard package manager.&lt;/p&gt;
&lt;h3 id=&quot;finding-pip-on-your-system&quot;&gt;Finding &lt;code&gt;pip&lt;/code&gt; on Your System&lt;a class=&quot;headerlink&quot; href=&quot;#finding-pip-on-your-system&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The Python 3 installer gives you the option to install &lt;code&gt;pip&lt;/code&gt; when installing Python on your system. In fact, the option to install &lt;code&gt;pip&lt;/code&gt; with Python is checked by default, so &lt;code&gt;pip&lt;/code&gt; should be ready for you to use after installing Python.&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; On some Linux (Unix) systems like Ubuntu, &lt;code&gt;pip&lt;/code&gt; comes in a separate package called &lt;code&gt;python3-pip&lt;/code&gt;, which you need to install with &lt;code&gt;sudo apt install python3-pip&lt;/code&gt;. It’s not installed by default with the interpreter.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can verify that &lt;code&gt;pip&lt;/code&gt; is available by looking for the &lt;code&gt;pip3&lt;/code&gt; executable on your system. Select your operating system below and use your platform-specific command accordingly:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

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




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

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight doscon&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;C:\&amp;gt;&lt;/span&gt; where pip3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;where&lt;/code&gt; command on Windows will show you where you can find the executable of &lt;code&gt;pip3&lt;/code&gt;. If Windows can’t find an executable named &lt;code&gt;pip3&lt;/code&gt;, then you can also try looking for &lt;code&gt;pip&lt;/code&gt; without the three (&lt;code&gt;3&lt;/code&gt;) at the end.&lt;/p&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;which pip3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;which&lt;/code&gt; command on Linux systems and macOS shows you where the &lt;code&gt;pip3&lt;/code&gt; binary file is located.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;On Windows and Unix systems, &lt;code&gt;pip3&lt;/code&gt; may be found in more than one location. This can happen when you have multiple Python versions installed. If you can’t find &lt;code&gt;pip&lt;/code&gt; in any location on your system, then you may consider &lt;a href=&quot;#reinstalling-pip-when-errors-occur&quot;&gt;reinstalling pip&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Instead of running your system &lt;code&gt;pip&lt;/code&gt; directly, you can also run it as a Python module. In the next section, you’ll learn how.&lt;/p&gt;
&lt;h3 id=&quot;running-pip-as-a-module&quot;&gt;Running &lt;code&gt;pip&lt;/code&gt; as a Module&lt;a class=&quot;headerlink&quot; href=&quot;#running-pip-as-a-module&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When you run your system &lt;code&gt;pip&lt;/code&gt; directly, the command itself doesn’t reveal which Python version &lt;code&gt;pip&lt;/code&gt; belongs to. This unfortunately means that you could use &lt;code&gt;pip&lt;/code&gt; to install a package into the site-packages of an old Python version without noticing. To prevent this from happening, you can run &lt;code&gt;pip&lt;/code&gt; as a Python module:&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;python3 -m pip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Notice that you use &lt;code&gt;python3 -m&lt;/code&gt; to run &lt;code&gt;pip&lt;/code&gt;. The &lt;code&gt;-m&lt;/code&gt; switch tells Python to run a module as an executable of the &lt;code&gt;python3&lt;/code&gt; interpreter. This way, you can ensure that your system default Python 3 version runs the &lt;code&gt;pip&lt;/code&gt; command. If you want to learn more about this way of running &lt;code&gt;pip&lt;/code&gt;, then you can read Brett Cannon’s insightful article about &lt;a href=&quot;https://snarky.ca/why-you-should-use-python-m-pip/&quot;&gt;the advantages of using &lt;code&gt;python3 -m pip&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Sometimes you may want to be more explicit and limit packages to a specific project. In situations like this, you should run &lt;code&gt;pip&lt;/code&gt; inside a &lt;strong&gt;virtual environment&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;using-pip-in-a-python-virtual-environment&quot;&gt;Using &lt;code&gt;pip&lt;/code&gt; in a Python Virtual Environment&lt;a class=&quot;headerlink&quot; href=&quot;#using-pip-in-a-python-virtual-environment&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To avoid installing packages directly into your system Python installation, you can use a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. A virtual environment provides an isolated Python interpreter for your project. Any packages that you use inside this environment will be independent of your system interpreter. This means that you can keep your project’s dependencies separate from other projects and the system at large.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/what-is-pip/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/what-is-pip/ »&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&#x27;s len() Function</title>
      <id>https://realpython.com/courses/pythons-len-function/</id>
      <link href="https://realpython.com/courses/pythons-len-function/"/>
      <updated>2022-02-01T14:00:00+00:00</updated>
      <summary>In this course, 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;p&gt;In many situations, you&amp;rsquo;ll need to find the number of items stored in a data structure. Python&amp;rsquo;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&amp;rsquo;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 course, you&amp;rsquo;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;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>Draw the Mandelbrot Set in Python</title>
      <id>https://realpython.com/mandelbrot-set-python/</id>
      <link href="https://realpython.com/mandelbrot-set-python/"/>
      <updated>2022-01-31T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll visualize the famous Mandelbrot set using Python&#x27;s Matplotlib and Pillow libraries. You&#x27;ll learn how to draw the fractal in black and white, grayscale, and color.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;This tutorial will guide you through a fun project involving &lt;a href=&quot;https://realpython.com/python-complex-numbers/&quot;&gt;complex numbers in Python&lt;/a&gt;. You’re going to learn about fractals and create some truly stunning art by drawing the &lt;strong&gt;Mandelbrot set&lt;/strong&gt; using Python’s Matplotlib and Pillow libraries. Along the way, you’ll learn how this famous fractal was discovered, what it represents, and how it relates to other fractals.&lt;/p&gt;
&lt;p&gt;Knowing about &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; principles and &lt;a href=&quot;https://realpython.com/python-recursion/&quot;&gt;recursion&lt;/a&gt; will enable you to take full advantage of Python’s expressive syntax to write clean code that reads almost like math formulas. To understand the algorithmic details of making fractals, you should also be comfortable with &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_number&quot;&gt;complex numbers&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Logarithm&quot;&gt;logarithms&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Set_theory&quot;&gt;set theory&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Iterated_function&quot;&gt;iterated functions&lt;/a&gt;. But don’t let these prerequisites scare you away, as you’ll be able to follow along and produce the art anyway!&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;Apply &lt;strong&gt;complex numbers&lt;/strong&gt; to a practical problem&lt;/li&gt;
&lt;li&gt;Find members of the &lt;strong&gt;Mandelbrot&lt;/strong&gt; and &lt;strong&gt;Julia&lt;/strong&gt; sets&lt;/li&gt;
&lt;li&gt;Draw these sets as &lt;strong&gt;fractals&lt;/strong&gt; using &lt;strong&gt;Matplotlib&lt;/strong&gt; and &lt;strong&gt;Pillow&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Make a &lt;strong&gt;colorful&lt;/strong&gt; artistic representation of the fractals&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To download the source code used in this tutorial, click the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/mandelbrot-set-python-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-mandelbrot-set-python-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 draw the Mandelbrot set.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-the-mandelbrot-set&quot;&gt;Understanding the Mandelbrot Set&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-the-mandelbrot-set&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before you try to draw the fractal, it’ll help to understand what the corresponding Mandelbrot set represents and how to determine its members. If you’re already familiar with the underlying theory, then feel free to skip ahead to the &lt;a href=&quot;#plotting-the-mandelbrot-set-using-pythons-matplotlib&quot;&gt;plotting section&lt;/a&gt; below.&lt;/p&gt;
&lt;h3 id=&quot;the-icon-of-fractal-geometry&quot;&gt;The Icon of Fractal Geometry&lt;a class=&quot;headerlink&quot; href=&quot;#the-icon-of-fractal-geometry&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Even if the name is new to you, you might have seen some mesmerizing visualizations of the Mandelbrot set before. It’s a set of &lt;strong&gt;complex numbers&lt;/strong&gt;, whose boundary forms a distinctive and intricate pattern when depicted on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_plane&quot;&gt;complex plane&lt;/a&gt;. That pattern became arguably the most famous &lt;a href=&quot;https://en.wikipedia.org/wiki/Fractal&quot;&gt;fractal&lt;/a&gt;, giving birth to &lt;strong&gt;fractal geometry&lt;/strong&gt; in the late 20th century:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg&quot; width=&quot;2560&quot; height=&quot;1920&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg&amp;amp;w=640&amp;amp;sig=57269fdb9ff1cdea47d7308abbaa43981eb2cebd 640w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg&amp;amp;w=1280&amp;amp;sig=2c78a0e4f66e60244225e76f5ff1793712e3bbc2 1280w, https://files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg 2560w&quot; sizes=&quot;75vw&quot; alt=&quot;Mandelbrot Set (Source: Wikimedia, Created by Wolfgang Beyer, CC BY-SA 3.0)&quot; data-asset=&quot;4050&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Mandelbrot Set (Source: Wikimedia, Created by Wolfgang Beyer, CC BY-SA 3.0)&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;The discovery of the Mandelbrot set was possible thanks to technological advancement. It’s attributed to a mathematician named &lt;a href=&quot;https://en.wikipedia.org/wiki/Benoit_Mandelbrot&quot;&gt;Benoît Mandelbrot&lt;/a&gt;. He worked at IBM and had access to a computer capable of what was, at the time, demanding number crunching. Today, you can explore fractals in the comfort of your home, using nothing more than Python!&lt;/p&gt;
&lt;p&gt;Fractals are &lt;strong&gt;infinitely repeating&lt;/strong&gt; patterns on &lt;strong&gt;different scales&lt;/strong&gt;. While philosophers have argued for centuries about the existence of infinity, fractals do have an analogy in the real world. It’s a fairly common phenomenon occurring in nature. For example, this Romanesco cauliflower is finite but has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Self-similarity&quot;&gt;self-similar&lt;/a&gt; structure because each part of the vegetable looks like the whole, only smaller:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/cauliflower.422e79018866.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/cauliflower.422e79018866.jpg&quot; width=&quot;1954&quot; height=&quot;1301&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/cauliflower.422e79018866.jpg&amp;amp;w=488&amp;amp;sig=5f5c2986c0edf851f31bc84f86e2b024215db413 488w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/cauliflower.422e79018866.jpg&amp;amp;w=977&amp;amp;sig=fafc845f08319b4c31d8f1defc7ac63815c86652 977w, https://files.realpython.com/media/cauliflower.422e79018866.jpg 1954w&quot; sizes=&quot;75vw&quot; alt=&quot;Fractal Structure of a Cauliflower&quot; data-asset=&quot;3661&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Fractal Structure of a Romanesco Cauliflower&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Self-similarity can often be defined mathematically with &lt;a href=&quot;https://realpython.com/python-thinking-recursively/&quot;&gt;recursion&lt;/a&gt;. The Mandelbrot set isn’t perfectly self-similar as it contains slightly different copies of itself at smaller scales. Nevertheless, it can still be described by a recursive function in the complex domain.&lt;/p&gt;
&lt;h3 id=&quot;the-boundary-of-iterative-stability&quot;&gt;The Boundary of Iterative Stability&lt;a class=&quot;headerlink&quot; href=&quot;#the-boundary-of-iterative-stability&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Formally, the Mandelbrot set is the set of complex numbers, &lt;em&gt;c&lt;/em&gt;, for which an infinite sequence of numbers, &lt;em&gt;z&lt;sub&gt;0&lt;/sub&gt;&lt;/em&gt;, &lt;em&gt;z&lt;sub&gt;1&lt;/sub&gt;&lt;/em&gt;, …, &lt;em&gt;z&lt;sub&gt;n&lt;/sub&gt;&lt;/em&gt;, …, remains &lt;a href=&quot;https://en.wikipedia.org/wiki/Bounded_function&quot;&gt;bounded&lt;/a&gt;. In other words, there is a limit that the magnitude of each complex number in that sequence never exceeds. The Mandelbrot sequence is given by the following recursive formula:&lt;/p&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/latex_mandelbrot.95af84d59784.png&quot; width=&quot;1650&quot; height=&quot;350&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/latex_mandelbrot.95af84d59784.png&amp;amp;w=412&amp;amp;sig=49a86f0502657a027fe77e5ee6967a74074fd425 412w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/latex_mandelbrot.95af84d59784.png&amp;amp;w=825&amp;amp;sig=76fd043318d344bd0c1a04d1b4d08579192d8a8e 825w, https://files.realpython.com/media/latex_mandelbrot.95af84d59784.png 1650w&quot; sizes=&quot;75vw&quot; alt=&quot;Mandelbrot Set Formula&quot; data-asset=&quot;3662&quot;&gt;&lt;/figure&gt;

&lt;p&gt;In plain English, to decide whether some complex number, &lt;em&gt;c&lt;/em&gt;, belongs to the Mandelbrot set, you must feed that number to the formula above. From now on, the number &lt;em&gt;c&lt;/em&gt; will remain constant as you iterate the sequence. The first element of the sequence, &lt;em&gt;z&lt;sub&gt;0&lt;/sub&gt;&lt;/em&gt;, is always equal to zero. To calculate the next element, &lt;em&gt;z&lt;sub&gt;n+1&lt;/sub&gt;&lt;/em&gt;, you’ll keep &lt;strong&gt;squaring&lt;/strong&gt; the last element, &lt;em&gt;z&lt;sub&gt;n&lt;/sub&gt;&lt;/em&gt;, and &lt;strong&gt;adding&lt;/strong&gt; your initial number, &lt;em&gt;c&lt;/em&gt;, in a feedback loop.&lt;/p&gt;
&lt;p&gt;By observing how the resulting sequence of numbers behaves, you’ll be able to classify your complex number, &lt;em&gt;c&lt;/em&gt;, as either a Mandelbrot set member or not. The sequence is infinite, but you must stop calculating its elements at some point. Making that choice is somewhat arbitrary and depends on your accepted level of confidence, as more elements will provide a more accurate ruling on &lt;em&gt;c&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The entire Mandelbrot set fits in a circle with a radius of two when depicted on the complex plane. This is a handy fact that’ll let you skip many unnecessary calculations for points that certainly don’t belong to the set.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;With complex numbers, you can imagine this iterative process visually in two dimensions, but you can go ahead and consider only real numbers for the sake of simplicity now. If you were to implement the above equation in Python, then it could look something like this:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Your &lt;code&gt;z()&lt;/code&gt; function returns the nth element of the sequence, which is why it expects an element’s index, &lt;code&gt;n&lt;/code&gt;, as the first argument. The second argument, &lt;code&gt;c&lt;/code&gt;, is a fixed number that you’re testing. This function would keep calling itself infinitely due to recursion. However, to break that chain of &lt;strong&gt;recursive&lt;/strong&gt; calls, a condition checks for the base case with an immediately known solution—zero.&lt;/p&gt;
&lt;p&gt;Try using your new function to find the first ten elements of the sequence for &lt;em&gt;c&lt;/em&gt; = 1, and see what happens:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/mandelbrot-set-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/mandelbrot-set-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #95: What Is a JIT and How Can Pyjion Speed Up Your Python?</title>
      <id>https://realpython.com/podcasts/rpp/95/</id>
      <link href="https://realpython.com/podcasts/rpp/95/"/>
      <updated>2022-01-28T12:00:00+00:00</updated>
      <summary>How can you can speed up Python? Have you thought of using a JIT (Just-In-Time Compiler)? This week on the show, we have Real Python author and previous guest Anthony Shaw to talk about his project Pyjion, a drop-in JIT compiler for CPython 3.10.</summary>
      <content type="html">
        &lt;p&gt;How can you can speed up Python? Have you thought of using a JIT (Just-In-Time Compiler)? This week on the show, we have Real Python author and previous guest Anthony Shaw to talk about his project Pyjion, a drop-in JIT compiler for CPython 3.10.&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>Looping With Python enumerate()</title>
      <id>https://realpython.com/courses/looping-with-python-enumerate/</id>
      <link href="https://realpython.com/courses/looping-with-python-enumerate/"/>
      <updated>2022-01-25T14:00:00+00:00</updated>
      <summary>Once you learn about for loops in Python, you know that using an index to access items in a sequence isn&#x27;t very Pythonic. So what do you do when you need that index value? In this course, you&#x27;ll learn all about Python&#x27;s built-in enumerate(), where it&#x27;s used, and how you can emulate its behavior.</summary>
      <content type="html">
        &lt;p&gt;In Python, a &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt; is usually written as a loop over an iterable object. This means that you don&amp;rsquo;t need a counting variable to access items in the iterable. Sometimes, though, you do want to have a variable that changes on each loop iteration. Rather than creating and incrementing a variable yourself, you can use Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;enumerate()&lt;/code&gt;&lt;/strong&gt; to get a counter and the value from the iterable at the same time!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll see how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;enumerate()&lt;/code&gt;&lt;/strong&gt; to get a counter in a loop&lt;/li&gt;
&lt;li&gt;Apply &lt;code&gt;enumerate()&lt;/code&gt; to &lt;strong&gt;display item counts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Implement your own &lt;strong&gt;equivalent function&lt;/strong&gt; to &lt;code&gt;enumerate()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unpack values&lt;/strong&gt; returned by &lt;code&gt;enumerate()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #94: Designing for Users and Building a Social Network With Django</title>
      <id>https://realpython.com/podcasts/rpp/94/</id>
      <link href="https://realpython.com/podcasts/rpp/94/"/>
      <updated>2022-01-21T12:00:00+00:00</updated>
      <summary>Are you looking for a project to practice your Django skills? Designing the fundamental interactions of a social network is an instructive way to explore models and relationships while learning advanced Django skills. This week on the show, we talk with previous guest Martin Breuss about his new four-part series, &quot;Build a Social Network With Django&quot;.</summary>
      <content type="html">
        &lt;p&gt;Are you looking for a project to practice your Django skills? Designing the fundamental interactions of a social network is an instructive way to explore models and relationships while learning advanced Django skills. This week on the show, we talk with previous guest Martin Breuss about his new four-part series, &quot;Build a Social Network With Django&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>Starting With Python IDLE</title>
      <id>https://realpython.com/courses/starting-python-idle/</id>
      <link href="https://realpython.com/courses/starting-python-idle/"/>
      <updated>2022-01-18T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to use the development environment included with your Python installation. Python IDLE is a small program that packs a big punch!  You&#x27;ll learn how to use Python IDLE to interact with Python directly, work with Python files, and improve your development workflow.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;ve recently downloaded Python onto your computer, then you may have noticed a new program on your machine called &lt;strong&gt;IDLE&lt;/strong&gt;. You might be wondering, &amp;ldquo;What is this program doing on my computer? I didn&amp;rsquo;t download that!&amp;rdquo; While you may not have downloaded this program on your own, IDLE comes bundled with every Python installation. It&amp;rsquo;s there to help you get started with the language right out of the box. In this course, you&amp;rsquo;ll learn how to work in Python IDLE and a few cool tricks you can use on your Python journey!&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 Python IDLE is&lt;/li&gt;
&lt;li&gt;How to interact with Python directly using IDLE&lt;/li&gt;
&lt;li&gt;How to edit, execute, and debug Python files with IDLE&lt;/li&gt;
&lt;li&gt;How to customize Python IDLE to your liking&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 #93: Launching Python, Virtual Environments, and Locking Dependencies With Brett Cannon</title>
      <id>https://realpython.com/podcasts/rpp/93/</id>
      <link href="https://realpython.com/podcasts/rpp/93/"/>
      <updated>2022-01-14T12:00:00+00:00</updated>
      <summary>Would you like a simple command to launch your Python programs using the newest version of the language installed on your machine? This week on the show, we continue our conversation with Brett Cannon. Brett discusses his project, the Python Launcher for Unix.</summary>
      <content type="html">
        &lt;p&gt;Would you like a simple command to launch your Python programs using the newest version of the language installed on your machine? This week on the show, we continue our conversation with Brett Cannon. Brett discusses his project, the Python Launcher for Unix.&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>Working With Pipenv</title>
      <id>https://realpython.com/courses/working-with-pipenv/</id>
      <link href="https://realpython.com/courses/working-with-pipenv/"/>
      <updated>2022-01-11T14:00:00+00:00</updated>
      <summary>Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv, and requirements.txt. In this course, you&#x27;ll go over what problems Pipenv solves and how to manage your Python dependencies with it.</summary>
      <content type="html">
        &lt;p&gt;Managing multiple Python projects with their own third-party packages can get complicated. It is best practice to use a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; to sandbox the requirements for each of your &lt;a href=&quot;https://realpython.com/intermediate-python-project-ideas/&quot;&gt;projects&lt;/a&gt;. Enter &lt;code&gt;pipenv&lt;/code&gt;, the &lt;a href=&quot;https://packaging.python.org/tutorials/managing-dependencies/#managing-dependencies&quot;&gt;official recommended package management tool for Python&lt;/a&gt;. It handles both installation and virtual environments to help you &lt;a href=&quot;https://realpython.com/courses/managing-python-dependencies/&quot;&gt;manage your Python dependencies&lt;/a&gt;.&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;How to use &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; to &lt;strong&gt;install a package&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Where Python puts packages by &lt;strong&gt;default&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to use &lt;a href=&quot;https://docs.pipenv.org/&quot;&gt;&lt;code&gt;pipenv&lt;/code&gt;&lt;/a&gt; to create &lt;strong&gt;virtual environments&lt;/strong&gt; and install packages&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;pipenv&lt;/code&gt; handles &lt;strong&gt;package conflicts&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 #92: Continuing to Unravel Python&#x27;s Syntactic Sugar With Brett Cannon</title>
      <id>https://realpython.com/podcasts/rpp/92/</id>
      <link href="https://realpython.com/podcasts/rpp/92/"/>
      <updated>2022-01-07T12:00:00+00:00</updated>
      <summary>A year ago, we had Brett Cannon on the show to discuss his blog series about unravelling Python&#x27;s syntactic sugar. Brett has written 15 more entries in the series, and he returns to the show this week to continue our conversation. We dive into unravelling &#x27;async&#x27; and &#x27;await&#x27; statements and their relationship with Python&#x27;s generators.</summary>
      <content type="html">
        &lt;p&gt;A year ago, we had Brett Cannon on the show to discuss his blog series about unravelling Python&#x27;s syntactic sugar. Brett has written 15 more entries in the series, and he returns to the show this week to continue our conversation. We dive into unravelling &#x27;async&#x27; and &#x27;await&#x27; statements and their relationship with Python&#x27;s generators.&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>Deploy Your Python Script on the Web With Flask</title>
      <id>https://realpython.com/courses/deploy-python-script-web-flask/</id>
      <link href="https://realpython.com/courses/deploy-python-script-web-flask/"/>
      <updated>2022-01-04T14:00:00+00:00</updated>
      <summary>In this course, you’ll learn how to go from a local Python script to a fully deployed Flask web application that you can share with the world.</summary>
      <content type="html">
        &lt;p&gt;You wrote a Python script that you&amp;rsquo;re proud of, and now you want to show it off to the world. But &lt;em&gt;how&lt;/em&gt;? Most people won&amp;rsquo;t know what to do with your &lt;code&gt;.py&lt;/code&gt; file. Converting your script into a &lt;strong&gt;Python web application&lt;/strong&gt; is a great solution to make your code usable for a broad audience.&lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll learn how to go from a local Python script to a fully deployed Flask web application that you can share with the world.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;web applications&lt;/strong&gt; are and how you can &lt;strong&gt;host&lt;/strong&gt; them online&lt;/li&gt;
&lt;li&gt;How to convert a Python script into a &lt;strong&gt;Flask web application&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to improve user experience by &lt;strong&gt;adding HTML&lt;/strong&gt; to your Python code&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;deploy&lt;/strong&gt; your Python web application to &lt;strong&gt;Google App Engine&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 #91: 2021 Real Python Articles Wrap Up</title>
      <id>https://realpython.com/podcasts/rpp/91/</id>
      <link href="https://realpython.com/podcasts/rpp/91/"/>
      <updated>2021-12-24T12:00:00+00:00</updated>
      <summary>It&#x27;s been a year of change at Real Python! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python articles this year. We also added many new members to the team, updated the site&#x27;s features, and created new styles of tutorials and projects.</summary>
      <content type="html">
        &lt;p&gt;It&#x27;s been a year of change at Real Python! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python articles this year. We also added many new members to the team, updated the site&#x27;s features, and created new styles of tutorials and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Raising and Handling Python Exceptions</title>
      <id>https://realpython.com/courses/raising-handling-exceptions/</id>
      <link href="https://realpython.com/courses/raising-handling-exceptions/"/>
      <updated>2021-12-21T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn what an exception is and how it differs from a syntax error. You&#x27;ll learn about raising exceptions, making assertions, and catching exceptions to change the control flow of your program using the try, except, else, and finally keywords.</summary>
      <content type="html">
        &lt;p&gt;A Python program terminates as soon as it encounters an error. In Python, an error can be a syntax error or an exception.&lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll learn what an exception is and how it differs from a syntax error. After that, you&amp;rsquo;ll learn about raising exceptions and making assertions. Then, you&amp;rsquo;ll learn how to catch exceptions to prevent your program from unintentionally ending and to change the control flow of your program:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/try_except_else_finally.a7fac6c36c55.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/try_except_else_finally.a7fac6c36c55.png&quot; width=&quot;1394&quot; height=&quot;1000&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/try_except_else_finally.a7fac6c36c55.png&amp;amp;w=348&amp;amp;sig=e907487d269c5621117a71262eea6f12581c93de 348w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/try_except_else_finally.a7fac6c36c55.png&amp;amp;w=697&amp;amp;sig=6903754041189bdc1e28fbb3f1ab9b454c0214d1 697w, https://files.realpython.com/media/try_except_else_finally.a7fac6c36c55.png 1394w&quot; sizes=&quot;75vw&quot; alt=&quot;Diagram explaining try except else finally statements&quot; data-asset=&quot;398&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;You&amp;rsquo;ll learn about the basic use of a &lt;code&gt;try&lt;/code&gt; &amp;hellip; &lt;code&gt;except&lt;/code&gt; block, as well as how to extend it using &lt;code&gt;else&lt;/code&gt; and &lt;code&gt;finally&lt;/code&gt;.&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;Differentiate exceptions from &lt;strong&gt;syntax errors&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the &lt;strong&gt;&lt;code&gt;assert&lt;/code&gt;&lt;/strong&gt; keyword to check if a certain condition is met&lt;/li&gt;
&lt;li&gt;Write &lt;strong&gt;custom exceptions&lt;/strong&gt; that subclass &lt;code&gt;Exception&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Catch exceptions with a &lt;strong&gt;&lt;code&gt;try&lt;/code&gt;&lt;/strong&gt; &amp;hellip; &lt;strong&gt;&lt;code&gt;except&lt;/code&gt;&lt;/strong&gt; block&lt;/li&gt;
&lt;li&gt;Use the additional keywords &lt;strong&gt;&lt;code&gt;else&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;finally&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Catch &lt;strong&gt;built-in&lt;/strong&gt; exceptions&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>
