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

  
    <entry>
      <title>Build a Hash Table in Python With TDD</title>
      <id>https://realpython.com/python-hash-table/</id>
      <link href="https://realpython.com/python-hash-table/"/>
      <updated>2022-03-16T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll implement the classic hash table data structure using Python. Along the way, you&#x27;ll learn how to cope with various challenges such as hash code collisions while practicing test-driven development (TDD).</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Invented over half a century ago, the &lt;strong&gt;hash table&lt;/strong&gt; is a classic &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_structure&quot;&gt;data structure&lt;/a&gt; that has been fundamental to programming. To this day, it helps solve many real-life problems, such as indexing database tables, caching computed values, or implementing sets. It often comes up in &lt;a href=&quot;https://realpython.com/learning-paths/python-interview/&quot;&gt;job interviews&lt;/a&gt;, and Python uses hash tables all over the place to make name lookups almost instantaneous.&lt;/p&gt;
&lt;p&gt;Even though Python comes with its own hash table called &lt;code&gt;dict&lt;/code&gt;, it can be helpful to understand how hash tables work behind the curtain. A coding assessment may even task you with building one. This tutorial will walk you through the steps of implementing a hash table from scratch as if there were none in Python. Along the way, you’ll face a few challenges that’ll introduce important concepts and give you an idea of why hash tables are so fast.&lt;/p&gt;
&lt;p&gt;In addition to this, you’ll get a hands-on crash course in &lt;strong&gt;test-driven development (TDD)&lt;/strong&gt; and will actively practice it while building your hash table in a step-by-step fashion. You’re not required to have any prior experience with TDD, but at the same time, you won’t get bored even if you do!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How a &lt;strong&gt;hash table&lt;/strong&gt; differs from a &lt;strong&gt;dictionary&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How you can &lt;strong&gt;implement a hash table&lt;/strong&gt; from scratch in Python&lt;/li&gt;
&lt;li&gt;How you can deal with &lt;strong&gt;hash collisions&lt;/strong&gt; and other challenges&lt;/li&gt;
&lt;li&gt;What the desired properties of a &lt;strong&gt;hash function&lt;/strong&gt; are&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;Python’s &lt;code&gt;hash()&lt;/code&gt;&lt;/strong&gt; works behind the scenes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It’ll help if you’re already familiar with &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;Python dictionaries&lt;/a&gt; and have basic knowledge of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; principles. To get the complete source code and the intermediate steps of the hash table implemented in this tutorial, follow 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;Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-hash-table-source-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-hash-table-source-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the source code&lt;/a&gt; that you’ll use to build a hash table in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;get-to-know-the-hash-table-data-structure&quot;&gt;Get to Know the Hash Table Data Structure&lt;a class=&quot;headerlink&quot; href=&quot;#get-to-know-the-hash-table-data-structure&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before diving deeper, you should familiarize yourself with the terminology because it can get slightly confusing. Colloquially, the term &lt;strong&gt;hash table&lt;/strong&gt; or &lt;strong&gt;hash map&lt;/strong&gt; is often used interchangeably with the word &lt;strong&gt;dictionary&lt;/strong&gt;. However, there’s a subtle difference between the two concepts as the former is more specific than the latter.&lt;/p&gt;
&lt;h3 id=&quot;hash-table-vs-dictionary&quot;&gt;Hash Table vs Dictionary&lt;a class=&quot;headerlink&quot; href=&quot;#hash-table-vs-dictionary&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In computer science, a &lt;a href=&quot;https://en.wikipedia.org/wiki/Associative_array&quot;&gt;dictionary&lt;/a&gt; is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Abstract_data_type&quot;&gt;abstract data type&lt;/a&gt; made up of &lt;strong&gt;keys&lt;/strong&gt; and &lt;strong&gt;values&lt;/strong&gt; arranged in pairs. Moreover, it defines the following operations for those elements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add a key-value pair&lt;/li&gt;
&lt;li&gt;Delete a key-value pair&lt;/li&gt;
&lt;li&gt;Update a key-value pair&lt;/li&gt;
&lt;li&gt;Find a value associated with the given key&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In a sense, this abstract data type resembles a &lt;strong&gt;bilingual dictionary&lt;/strong&gt;, where the keys are foreign words, and the values are their definitions or translations to other languages. But there doesn’t always have to be a sense of equivalence between keys and values. A &lt;strong&gt;phone book&lt;/strong&gt; is another example of a dictionary, which combines names with the corresponding phone numbers.&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; Anytime you &lt;em&gt;map&lt;/em&gt; one thing to another or &lt;em&gt;associate&lt;/em&gt; a value with a key, you’re essentially using a kind of a dictionary. That’s why dictionaries are also known as &lt;strong&gt;maps&lt;/strong&gt; or &lt;strong&gt;associative arrays&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Dictionaries have a few interesting properties. One of them is that you can think of a dictionary as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Function_(mathematics)&quot;&gt;mathematical function&lt;/a&gt; that projects one or more arguments to exactly one value. The direct consequences of that fact are the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Only Key-Value Pairs:&lt;/strong&gt; You can’t have a key without the value or the other way around in a dictionary. They always go together.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Arbitrary Keys and Values:&lt;/strong&gt; Keys and values can belong to two &lt;a href=&quot;https://en.wikipedia.org/wiki/Disjoint_sets&quot;&gt;disjoint sets&lt;/a&gt; of the same or separate types. Both keys and values may be almost anything, such as numbers, words, or even pictures.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unordered Key-Value Pairs:&lt;/strong&gt; Because of the last point, dictionaries don’t generally define any order for their key-value pairs. However, that might be implementation-specific.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unique Keys:&lt;/strong&gt; A dictionary can’t contain duplicate keys, because that would violate the definition of a function.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Non-Unique Values:&lt;/strong&gt; The same value can be associated with many keys, but it doesn’t have to.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are related concepts that extend the idea of a dictionary. For example, a &lt;a href=&quot;https://en.wikipedia.org/wiki/Multimap&quot;&gt;multimap&lt;/a&gt; lets you have more than one value per key, while a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bidirectional_map&quot;&gt;bidirectional map&lt;/a&gt; not only maps keys to values but also provides mapping in the opposite direction. However, in this tutorial, you’re only going to consider the regular dictionary, which maps exactly one value to each key.&lt;/p&gt;
&lt;p&gt;Here’s a graphical depiction of a hypothetical dictionary, which maps some abstract concepts to their corresponding English words:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/dict_map.6ea6c6e33b4b.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/dict_map.6ea6c6e33b4b.png&quot; width=&quot;1405&quot; height=&quot;1125&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/dict_map.6ea6c6e33b4b.png&amp;amp;w=351&amp;amp;sig=a6cd176c7fe425cd71f22c73f62280f32388b59e 351w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/dict_map.6ea6c6e33b4b.png&amp;amp;w=702&amp;amp;sig=30452c5332ce10b4c459181f482a38000dbc019e 702w, https://files.realpython.com/media/dict_map.6ea6c6e33b4b.png 1405w&quot; sizes=&quot;75vw&quot; alt=&quot;Graphical Depiction of a Dictionary Abstract Data Type&quot; data-asset=&quot;4019&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Graphical Depiction of a Dictionary Abstract Data Type&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;It’s a one-way map of keys to values, which are two completely different sets of elements. Right away, you can see fewer values than keys because the word &lt;em&gt;bow&lt;/em&gt; happens to be a &lt;a href=&quot;https://en.wikipedia.org/wiki/Homonym&quot;&gt;homonym&lt;/a&gt; with multiple meanings. Conceptually, this dictionary still contains four pairs, though. Depending on how you decided to implement it, you could reuse repeated values to conserve memory or duplicate them for simplicity.&lt;/p&gt;
&lt;p&gt;Now, how do you code such a dictionary in a programming language? The right answer is you &lt;em&gt;don’t&lt;/em&gt;, because most modern languages come with dictionaries as either &lt;a href=&quot;https://en.wikipedia.org/wiki/Primitive_data_type&quot;&gt;primitive data types&lt;/a&gt; or classes in their &lt;a href=&quot;https://en.wikipedia.org/wiki/Standard_library&quot;&gt;standard libraries&lt;/a&gt;. Python ships with a built-in &lt;code&gt;dict&lt;/code&gt; type, which already wraps a highly optimized data structure written in C so that you don’t have to write a dictionary yourself.&lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;dict&lt;/code&gt; lets you perform all the dictionary operations listed at the beginning of this section:&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;glossary&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;BDFL&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Benevolent Dictator For Life&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;glossary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;GIL&quot;&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;s2&quot;&gt;&quot;Global Interpreter Lock&quot;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Add&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;glossary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;BDFL&quot;&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;s2&quot;&gt;&quot;Guido van Rossum&quot;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Update&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;del&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;glossary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;GIL&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Delete&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;glossary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;BDFL&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Search&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Guido van Rossum&#x27;&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;glossary&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{&#x27;BDFL&#x27;: &#x27;Guido van Rossum&#x27;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With the &lt;strong&gt;square bracket syntax&lt;/strong&gt; (&lt;code&gt;[ ]&lt;/code&gt;), you can add a new key-value pair to a dictionary. You can also update the value of or delete an existing pair identified by a key. Finally, you can look up the value associated with the given key.&lt;/p&gt;
&lt;p&gt;That said, you may ask a different question. How does the built-in dictionary actually work? How does it map keys of arbitrary data types, and how does it do it so quickly?&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-hash-table/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-hash-table/ »&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>Sorting Data in Python With Pandas</title>
      <id>https://realpython.com/courses/sorting-data-python-pandas/</id>
      <link href="https://realpython.com/courses/sorting-data-python-pandas/"/>
      <updated>2022-03-15T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to sort data in a pandas DataFrame using the pandas sort functions sort_values() and sort_index(). You&#x27;ll learn how to sort by one or more columns and by index in ascending or descending order.</summary>
      <content type="html">
        &lt;p&gt;Learning pandas &lt;strong&gt;sort methods&lt;/strong&gt; is a great way to start with or practice doing basic &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;data analysis using Python&lt;/a&gt;. Most commonly, data analysis is done with &lt;a href=&quot;https://realpython.com/openpyxl-excel-spreadsheets-python/&quot;&gt;spreadsheets&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-sql-libraries/&quot;&gt;SQL&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/learning-paths/pandas-data-science/&quot;&gt;pandas&lt;/a&gt;. One of the great things about using pandas is that it can handle a large amount of data and offers highly performant data manipulation capabilities.&lt;/p&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll learn how to use &lt;code&gt;.sort_values()&lt;/code&gt; and &lt;code&gt;.sort_index()&lt;/code&gt;, which will enable you to sort data efficiently in a DataFrame.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll know how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sort a &lt;strong&gt;pandas DataFrame&lt;/strong&gt; by the values of one or more columns&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;ascending&lt;/code&gt; parameter to change the &lt;strong&gt;sort order&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Sort a DataFrame by its &lt;code&gt;index&lt;/code&gt; using &lt;strong&gt;&lt;code&gt;.sort_index()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Organize &lt;strong&gt;missing data&lt;/strong&gt; while sorting values&lt;/li&gt;
&lt;li&gt;Sort a DataFrame &lt;strong&gt;in-place&lt;/strong&gt; using &lt;code&gt;inplace&lt;/code&gt; set to &lt;code&gt;True&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>Python Class Constructors: Control Your Object Instantiation</title>
      <id>https://realpython.com/python-class-constructor/</id>
      <link href="https://realpython.com/python-class-constructor/"/>
      <updated>2022-03-14T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how class constructors work in Python. You&#x27;ll also explore Python&#x27;s instantiation process, which has two main steps: instance creation and instance initialization.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Class constructors are a fundamental part of &lt;strong&gt;object-oriented programming&lt;/strong&gt; in Python. They allow you to create and properly initialize objects of a given class, making those objects ready to use. Class constructors internally trigger Python’s instantiation process, which runs through two main steps: &lt;strong&gt;instance creation&lt;/strong&gt; and &lt;strong&gt;instance initialization&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you want to dive deeper into how Python internally constructs objects and learn how to customize the process, then this tutorial is for you.&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;Understand Python’s internal &lt;strong&gt;instantiation process&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Customize object initialization using &lt;strong&gt;&lt;code&gt;.__init__()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Fine-tune object creation by overriding &lt;strong&gt;&lt;code&gt;.__new__()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With this knowledge, you’ll be able to tweak the creation and initialization of objects in your custom Python classes, which will give you control over the instantiation process at a more advanced level.&lt;/p&gt;
&lt;p&gt;To better understand the examples and concepts in this tutorial, you should be familiar with &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; and &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-special-method&quot;&gt;special methods&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;pythons-class-constructors-and-the-instantiation-process&quot;&gt;Python’s Class Constructors and the Instantiation Process&lt;a class=&quot;headerlink&quot; href=&quot;#pythons-class-constructors-and-the-instantiation-process&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Like many other programming languages, Python supports &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;. At the heart of Python’s object-oriented capabilities, you’ll find 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, which allows you to define custom classes that can have &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#class-and-instance-attributes&quot;&gt;attributes&lt;/a&gt; for storing data and &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#instance-methods&quot;&gt;methods&lt;/a&gt; for providing behaviors.&lt;/p&gt;
&lt;p&gt;Once you have a class to work with, then you can start creating new &lt;strong&gt;instances&lt;/strong&gt; or &lt;strong&gt;objects&lt;/strong&gt; of that class, which is an efficient way to reuse functionality in your code.&lt;/p&gt;
&lt;p&gt;Creating and initializing objects of a given class is a fundamental step in object-oriented programming. This step is often referred to as &lt;strong&gt;object construction&lt;/strong&gt; or &lt;strong&gt;instantiation&lt;/strong&gt;. The tool responsible for running this instantiation process is commonly known as a &lt;strong&gt;class constructor&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;getting-to-know-pythons-class-constructors&quot;&gt;Getting to Know Python’s Class Constructors&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-pythons-class-constructors&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In Python, to construct an object of a given class, you just need to call the class with appropriate arguments, as you would call any &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;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SomeClass&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;pass&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;c1&quot;&gt;# Call the class to construct an object&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;SomeClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;__main__.SomeClass object at 0x7fecf442a140&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, you define &lt;code&gt;SomeClass&lt;/code&gt; using the &lt;code&gt;class&lt;/code&gt; keyword. This class is currently empty because it doesn’t have attributes or methods. Instead, the class’s body only contains a &lt;a href=&quot;https://realpython.com/python-pass/&quot;&gt;&lt;code&gt;pass&lt;/code&gt;&lt;/a&gt; statement as a placeholder statement that does nothing.&lt;/p&gt;
&lt;p&gt;Then you create a new instance of &lt;code&gt;SomeClass&lt;/code&gt; by calling the class with a pair of parentheses. In this example, you don’t need to pass any argument in the call because your class doesn’t take arguments yet.&lt;/p&gt;
&lt;p&gt;In Python, when you call a class as you did in the above example, you’re calling the class constructor, which creates, initializes, and returns a new object by triggering Python’s internal instantiation process.&lt;/p&gt;
&lt;p&gt;A final point to note is that calling a class isn’t the same as calling an &lt;em&gt;instance&lt;/em&gt; of a class. These are two different and unrelated topics. To make a class’s instance callable, you need to implement a &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__call__&quot;&gt;&lt;code&gt;.__call__()&lt;/code&gt;&lt;/a&gt; special method, which has nothing to do with Python’s instantiation process.&lt;/p&gt;
&lt;h3 id=&quot;understanding-pythons-instantiation-process&quot;&gt;Understanding Python’s Instantiation Process&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-pythons-instantiation-process&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You trigger Python’s &lt;strong&gt;instantiation process&lt;/strong&gt; whenever you call a Python class to create a new instance. This process runs through two separate steps, which you can describe as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create a new instance&lt;/strong&gt; of the target class&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Initialize the new instance&lt;/strong&gt; with an appropriate initial &lt;a href=&quot;https://en.wikipedia.org/wiki/State_(computer_science)&quot;&gt;state&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To run the first step, Python classes have a 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;, which is responsible for creating and returning a new empty object. Then another special method, &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;, takes the resulting object, along with the class constructor’s arguments.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;.__init__()&lt;/code&gt; method takes the new object as its first argument, &lt;code&gt;self&lt;/code&gt;. Then it sets any required instance attribute to a valid state using the arguments that the class constructor passed to it.&lt;/p&gt;
&lt;p&gt;In short, Python’s instantiation process starts with a call to the class constructor, which triggers the &lt;strong&gt;instance creator&lt;/strong&gt;, &lt;code&gt;.__new__()&lt;/code&gt;, to create a new empty object. The process continues with the &lt;strong&gt;instance initializer&lt;/strong&gt;, &lt;code&gt;.__init__()&lt;/code&gt;, which takes the constructor’s arguments to initialize the newly created object.&lt;/p&gt;
&lt;p&gt;To explore how Python’s instantiation process works internally, consider the following example of a &lt;code&gt;Point&lt;/code&gt; class that implements a custom version of both methods, &lt;code&gt;.__new__()&lt;/code&gt; and &lt;code&gt;.__init__()&lt;/code&gt;, for demonstration purposes:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-class-constructor/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-class-constructor/ »&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 #101: Tools for Setting Up Python on a New Machine</title>
      <id>https://realpython.com/podcasts/rpp/101/</id>
      <link href="https://realpython.com/podcasts/rpp/101/"/>
      <updated>2022-03-11T12:00:00+00:00</updated>
      <summary>There are many ways to get Python installed on your computer. If you were going to start fresh, what tools would you use? What if you need to manage multiple versions of Python and virtual environments? What about all the additional tools that make your coding workflow complete? This week on the show, Calvin Hendryx-Parker is here to talk about bootstrapping your Python environment.</summary>
      <content type="html">
        &lt;p&gt;There are many ways to get Python installed on your computer. If you were going to start fresh, what tools would you use? What if you need to manage multiple versions of Python and virtual environments? What about all the additional tools that make your coding workflow complete? This week on the show, Calvin Hendryx-Parker is here to talk about bootstrapping your Python environment.&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 3.11 Preview: Even Better Error Messages</title>
      <id>https://realpython.com/python311-error-messages/</id>
      <link href="https://realpython.com/python311-error-messages/"/>
      <updated>2022-03-09T14:00:00+00:00</updated>
      <summary>Python 3.11 will be released in October 2022. In this tutorial, you&#x27;ll install the latest alpha release of Python 3.11 in order to preview one of its anticipated features: more precise error messages that&#x27;ll help you debug your code more efficiently.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python 3.11 will be released in October 2022. Even though October is still months away, you can already preview some of the upcoming features, including how Python 3.11 will offer more readable and actionable error messages.&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;&lt;strong&gt;Install&lt;/strong&gt; Python 3.11 Alpha on your computer, next to your current Python installations&lt;/li&gt;
&lt;li&gt;Interpret the &lt;strong&gt;improved error messages&lt;/strong&gt; in Python 3.11 and learn to &lt;strong&gt;more efficiently debug&lt;/strong&gt; your code&lt;/li&gt;
&lt;li&gt;Connect these improvements to the &lt;strong&gt;PEG parser&lt;/strong&gt; and the &lt;strong&gt;better error messages&lt;/strong&gt; in Python 3.10&lt;/li&gt;
&lt;li&gt;Explore &lt;strong&gt;third-party packages&lt;/strong&gt; offering enhanced error messages&lt;/li&gt;
&lt;li&gt;Test smaller improvements in Python 3.11, including &lt;strong&gt;new math functions&lt;/strong&gt; and more &lt;strong&gt;readable fractions&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are many other improvements and features coming in Python 3.11. Keep track of &lt;a href=&quot;https://docs.python.org/3.11/whatsnew/3.11.html&quot;&gt;what’s new&lt;/a&gt; in the changelog for an up-to-date list.&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;python-311-alpha&quot;&gt;Python 3.11 Alpha&lt;a class=&quot;headerlink&quot; href=&quot;#python-311-alpha&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A new version of Python is released in October each year. The code is developed and tested over a &lt;a href=&quot;https://www.python.org/dev/peps/pep-0602/&quot;&gt;seventeen-month period&lt;/a&gt; before the release date. New features are implemented during the &lt;a href=&quot;https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha&quot;&gt;alpha phase&lt;/a&gt;, which lasts until May, about five months before the final release.&lt;/p&gt;
&lt;p&gt;About &lt;a href=&quot;https://www.python.org/dev/peps/pep-0664/&quot;&gt;once a month&lt;/a&gt; during the alpha phase, Python’s core developers release a new &lt;strong&gt;alpha version&lt;/strong&gt; to show off the new features, test them, and get early feedback. Currently, the latest version of Python 3.11 is &lt;strong&gt;3.11.0 alpha 5&lt;/strong&gt;, released on February 3, 2022.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This tutorial uses the fifth alpha version of Python 3.11. You might experience small differences if you use a later version. However, you can expect most of what you learn here to stay the same through the alpha and beta phases and in the final release of Python 3.11.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The first &lt;strong&gt;beta release&lt;/strong&gt; of Python 3.11 is planned for May 6, 2022. Typically, no new features are added during the &lt;a href=&quot;https://en.wikipedia.org/wiki/Software_release_life_cycle#Beta&quot;&gt;beta phase&lt;/a&gt;. Instead, the time between the feature freeze and the release date is used to test and solidify the code.&lt;/p&gt;
&lt;h3 id=&quot;cool-new-features&quot;&gt;Cool New Features&lt;a class=&quot;headerlink&quot; href=&quot;#cool-new-features&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Some of the currently announced highlights of Python 3.11 include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Enhanced error messages&lt;/strong&gt;, which will help you more effectively debug your code&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exception groups&lt;/strong&gt;, which will allow programs to raise and handle multiple exceptions at the same time&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Optimizations&lt;/strong&gt;, promising to make Python 3.11 significantly faster than previous versions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Static typing&lt;/strong&gt; improvements, which will let you &lt;a href=&quot;https://realpython.com/python-type-checking/#annotations&quot;&gt;annotate&lt;/a&gt; your code more precisely&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There’s a lot to look forward to in the upcoming Python 3.11 release! In this tutorial, you’ll focus on how the enhanced error reporting can improve your developer experience by letting you debug your code more efficiently. You’ll also get a peek at some of the other, smaller features that’ll be shipping with Python 3.11.&lt;/p&gt;
&lt;h3 id=&quot;installation&quot;&gt;Installation&lt;a class=&quot;headerlink&quot; href=&quot;#installation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To play with the code examples in this tutorial, you’ll need to install a version of Python 3.11 onto your system. In this section, you’ll learn about a few different ways to do this: using &lt;strong&gt;Docker&lt;/strong&gt;, using &lt;strong&gt;pyenv&lt;/strong&gt;, or installing from &lt;strong&gt;source&lt;/strong&gt;. Pick the one that works best for you and your system.&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; Alpha versions are previews of upcoming features. While most features will work well, you shouldn’t depend on any Python 3.11 alpha version in production or anywhere else where bugs will have serious consequences.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;If you have access to &lt;a href=&quot;https://docs.docker.com/get-docker/&quot;&gt;Docker&lt;/a&gt; on your system, then you can download the latest version of Python 3.11 by pulling and running the &lt;code&gt;python:3.11-rc-slim&lt;/code&gt; &lt;a href=&quot;https://hub.docker.com/_/python&quot;&gt;Docker image&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;docker pull python:3.11-rc-slim
&lt;span class=&quot;go&quot;&gt;Unable to find image &#x27;python:3.11-rc-slim&#x27; locally&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;latest: Pulling from library/python&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[...]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;docker run -it --rm python:3.11-rc-slim
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This drops you into a Python 3.11 REPL. Check out &lt;a href=&quot;https://realpython.com/python-versions-docker/#running-python-in-a-docker-container&quot;&gt;Run Python Versions in Docker&lt;/a&gt; for more information about how you can work with Python through Docker, including how you can run scripts.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://realpython.com/intro-to-pyenv/&quot;&gt;pyenv&lt;/a&gt; tool is great for managing different versions of Python on your system, and you can use it to install Python 3.11 Alpha if you like. It comes with two different versions, one for Windows and one for Linux and macOS:&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;p&gt;On Windows, you can use &lt;a href=&quot;https://pyenv-win.github.io/pyenv-win/&quot;&gt;pyenv-win&lt;/a&gt;. First update your &lt;code&gt;pyenv&lt;/code&gt; installation:&lt;/p&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; pyenv update
&lt;span class=&quot;go&quot;&gt;:: [Info] ::  Mirror: https://www.python.org/ftp/python&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[...]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Doing an update ensures that you can install the latest version of Python. You could also &lt;a href=&quot;https://pyenv-win.github.io/pyenv-win/#how-to-update-pyenv&quot;&gt;update &lt;code&gt;pyenv&lt;/code&gt; manually&lt;/a&gt;.&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;p&gt;On Linux and macOS, you can use &lt;a href=&quot;https://github.com/pyenv/pyenv&quot;&gt;pyenv&lt;/a&gt;. First update your &lt;code&gt;pyenv&lt;/code&gt; installation, using the &lt;a href=&quot;https://github.com/pyenv/pyenv-update&quot;&gt;&lt;code&gt;pyenv-update&lt;/code&gt;&lt;/a&gt; plugin:&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;pyenv update
&lt;span class=&quot;go&quot;&gt;Updating /home/realpython/.pyenv...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[...]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Doing an update ensures that you can install the latest version of Python. If you don’t want to use the update plugin, you can &lt;a href=&quot;https://github.com/pyenv/pyenv#upgrading&quot;&gt;update &lt;code&gt;pyenv&lt;/code&gt; manually&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Use &lt;code&gt;pyenv install --list&lt;/code&gt; to check which versions of Python 3.11 are available. Then, install the latest one:&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;pyenv install &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.11.0a5
&lt;span class=&quot;go&quot;&gt;Downloading Python-3.11.0a5.tar.xz...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[...]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python311-error-messages/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python311-error-messages/ »&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>Counting With Python&#x27;s Counter</title>
      <id>https://realpython.com/courses/counting-python-counter/</id>
      <link href="https://realpython.com/courses/counting-python-counter/"/>
      <updated>2022-03-08T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use Python&#x27;s Counter to count several repeated objects at once.</summary>
      <content type="html">
        &lt;p&gt;Counting several repeated objects at once is a common problem in programming. Python offers a bunch of tools and techniques you can use to approach this problem. However, Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;Counter&lt;/code&gt;&lt;/strong&gt; from &lt;a href=&quot;https://docs.python.org/3/library/collections.html#module-collections&quot;&gt;&lt;code&gt;collections&lt;/code&gt;&lt;/a&gt; provides a clean, efficient, and Pythonic solution.&lt;/p&gt;
&lt;p&gt;This &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt; subclass provides efficient counting capabilities out of the box. Understanding &lt;code&gt;Counter&lt;/code&gt; and how to use it efficiently is a convenient skill to have as a Python developer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Count &lt;strong&gt;several repeated objects&lt;/strong&gt; at once&lt;/li&gt;
&lt;li&gt;Create counters with Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;Counter&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Retrieve the &lt;strong&gt;most common objects&lt;/strong&gt; in a counter&lt;/li&gt;
&lt;li&gt;Update &lt;strong&gt;object counts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;Counter&lt;/code&gt; to facilitate &lt;strong&gt;further computations&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Implement &lt;code&gt;Counter&lt;/code&gt; instances as &lt;strong&gt;multisets&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 News: What&#x27;s New From February 2022?</title>
      <id>https://realpython.com/python-news-february-2022/</id>
      <link href="https://realpython.com/python-news-february-2022/"/>
      <updated>2022-03-07T14:00:00+00:00</updated>
      <summary>In February 2022, Python 3.11 Alpha 5 was released, and the schedule for the upcoming PyCon US became available. In this article, you&#x27;ll get the details of these exciting events and catch up on other important developments in the world of Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In &lt;strong&gt;February 2022&lt;/strong&gt;, another preview release of &lt;strong&gt;Python 3.11&lt;/strong&gt; became available for early adopters to test and share their feedback. Shortly afterward, the Python steering council announced that Python 3.11 would also include a &lt;strong&gt;TOML parser&lt;/strong&gt; in the standard library. In addition, &lt;strong&gt;GitHub Issues&lt;/strong&gt; will soon become the official bug tracking system for Python.&lt;/p&gt;
&lt;p&gt;In other news, &lt;strong&gt;PyCon US 2022&lt;/strong&gt; shared its conference schedule. The Python Software Foundation (PSF) wants to &lt;strong&gt;hire two contract developers&lt;/strong&gt; to improve the Python Package Index (PyPI). Apple is finally &lt;strong&gt;removing Python 2.7&lt;/strong&gt; from macOS.&lt;/p&gt;
&lt;p&gt;Let’s dive into the biggest &lt;strong&gt;Python news&lt;/strong&gt; from the past month!&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Join Now:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-newsletter&quot; data-focus=&quot;false&quot;&gt;Click here to join the Real Python Newsletter&lt;/a&gt; and you&#x27;ll never miss another Python tutorial, course update, or post.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;python-311-alpha-5-released&quot;&gt;Python 3.11 Alpha 5 Released&lt;a class=&quot;headerlink&quot; href=&quot;#python-311-alpha-5-released&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While the final release of &lt;strong&gt;Python 3.11&lt;/strong&gt; is planned for &lt;strong&gt;October 2022&lt;/strong&gt;, which is still months ahead, you can already check out what’s coming. According to the development and release schedule described in &lt;a href=&quot;https://www.python.org/dev/peps/pep-0664/&quot;&gt;PEP 664&lt;/a&gt;, Python 3.11 is now in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha&quot;&gt;alpha phase&lt;/a&gt; of its release cycle, which is meant to collect early feedback from users like you. At the beginning of February, &lt;a href=&quot;https://www.python.org/downloads/release/python-3110a5/&quot;&gt;3.11.0a5&lt;/a&gt;, the fifth of seven planned alpha releases, became available for testing.&lt;/p&gt;
&lt;p&gt;To play around with an alpha release of Python, you can grab the corresponding &lt;a href=&quot;https://realpython.com/python-versions-docker/&quot;&gt;Docker image&lt;/a&gt; from Docker Hub, install an alternative Python interpreter with &lt;a href=&quot;https://realpython.com/intro-to-pyenv/&quot;&gt;pyenv&lt;/a&gt;, or build the &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;CPython source code&lt;/a&gt; using a compiler tool. The source code method lets you clone &lt;a href=&quot;https://github.com/python/cpython&quot;&gt;CPython’s repository&lt;/a&gt; from GitHub and check out a bleeding-edge snapshot without waiting for an alpha release.&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; Features under development might be unstable and buggy, and they can be modified or removed from the final release without notice. As a result of that, you should never use preview releases in a production environment!&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;If you’d like to explore some of the most exciting features coming to Python 3.11, then make sure you can run the alpha release of the interpreter. You’ll find the commands to download and run &lt;strong&gt;Python 3.11.0a5&lt;/strong&gt; below:&lt;/p&gt;
&lt;div class=&quot;card mb-3&quot; id=&quot;collapse_card6949bc&quot;&gt;
&lt;div class=&quot;card-header border-0&quot;&gt;
&lt;p class=&quot;m-0&quot;&gt;&lt;button class=&quot;btn w-100&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#collapse6949bc&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;collapse6949bc&quot; markdown=&quot;1&quot;&gt;&lt;span class=&quot;float-left&quot; markdown=&quot;1&quot;&gt;Run with Docker&lt;/span&gt;&lt;span class=&quot;float-right text-muted&quot;&gt;Show/Hide&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;collapse js-collapsible-section&quot; data-parent=&quot;#collapse_card6949bc&quot; id=&quot;collapse6949bc&quot;&gt;
&lt;div class=&quot;card-body&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;docker pull python:3.11.0a5-slim
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;docker run -it --rm python:3.11.0a5-slim
&lt;span class=&quot;go&quot;&gt;Python 3.11.0a5 (main, Feb 25 2022, 20:02:52) [GCC 10.2.1 20210110] on linux&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;card mb-3&quot; id=&quot;collapse_cardd76d73&quot;&gt;
&lt;div class=&quot;card-header border-0&quot;&gt;
&lt;p class=&quot;m-0&quot;&gt;&lt;button class=&quot;btn w-100&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#collapsed76d73&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;collapsed76d73&quot; markdown=&quot;1&quot;&gt;&lt;span class=&quot;float-left&quot; markdown=&quot;1&quot;&gt;Run with pyenv&lt;/span&gt;&lt;span class=&quot;float-right text-muted&quot;&gt;Show/Hide&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;collapse js-collapsible-section&quot; data-parent=&quot;#collapse_cardd76d73&quot; id=&quot;collapsed76d73&quot;&gt;
&lt;div class=&quot;card-body&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;pyenv update
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;pyenv install &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.11.0a5
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;pyenv &lt;span class=&quot;nb&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.11.0a5
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python
&lt;span class=&quot;go&quot;&gt;Python 3.11.0a5 (main, Mar  1 2022, 10:05:02) [GCC 9.3.0] on linux&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;card mb-3&quot; id=&quot;collapse_card667805&quot;&gt;
&lt;div class=&quot;card-header border-0&quot;&gt;
&lt;p class=&quot;m-0&quot;&gt;&lt;button class=&quot;btn w-100&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#collapse667805&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;collapse667805&quot; markdown=&quot;1&quot;&gt;&lt;span class=&quot;float-left&quot; markdown=&quot;1&quot;&gt;Run from Source Code&lt;/span&gt;&lt;span class=&quot;float-right text-muted&quot;&gt;Show/Hide&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;collapse js-collapsible-section&quot; data-parent=&quot;#collapse_card667805&quot; id=&quot;collapse667805&quot;&gt;
&lt;div class=&quot;card-body&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;git clone git@github.com:python/cpython.git
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; cpython/
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;git checkout v3.11.0a5
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;./configure
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;make
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;./python
&lt;span class=&quot;go&quot;&gt;Python 3.11.0a5 (tags/v3.11.0a5:c4e4b91557, Mar  1 2022, 17:48:56) [GCC 9.3.0] on linux&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;So what’s all the hype about this alpha release? There are several big and small improvements, but for now, let’s focus on some of the Python 3.11 highlights!&lt;/p&gt;
&lt;h3 id=&quot;pep-657-error-locations-in-tracebacks&quot;&gt;PEP 657: Error Locations in Tracebacks&lt;a class=&quot;headerlink&quot; href=&quot;#pep-657-error-locations-in-tracebacks&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Python 3.10 has already greatly &lt;a href=&quot;https://realpython.com/python310-new-features/#better-error-messages&quot;&gt;improved its error messages&lt;/a&gt;. By pinpointing the root cause, providing context, and even suggesting fixes, error messages have become more human-friendly and helpful for Python beginners. Python 3.11 takes error messaging one step further to improve the debugging experience and expose an API for code analysis tools.&lt;/p&gt;
&lt;p&gt;Sometimes, a single line of code can contain multiple instructions or a complex expression, which would be hard to debug in older Python versions:&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;cat test.py
&lt;span class=&quot;go&quot;&gt;x, y, z = 1, 2, 0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;w = x / y / z&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3.10 test.py
&lt;span class=&quot;go&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  File &quot;/home/realpython/test.py&quot;, line 2, in &amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    w = x / y / z&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;ZeroDivisionError: float division by zero&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3.11a5 test.py
&lt;span class=&quot;go&quot;&gt;  File &quot;/home/realpython/test.py&quot;, line 2, in &amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    w = x / y / z&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;        ~~~~~~^~~&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;ZeroDivisionError: float division by zero&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, one of the variables causes a zero division error. Python 3.10 tells you about the problem, but it doesn’t indicate the culprit. In Python 3.11, the &lt;a href=&quot;https://realpython.com/python-traceback/&quot;&gt;traceback&lt;/a&gt; will include &lt;strong&gt;visual feedback&lt;/strong&gt; about the exact location on a line that raised an exception. You’ll also have a &lt;strong&gt;programmatic way&lt;/strong&gt; of getting that same information for tools.&lt;/p&gt;
&lt;p&gt;Note that some of these enhanced tracebacks won’t work for code evaluated on the fly in the Python &lt;a href=&quot;https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop&quot;&gt;REPL&lt;/a&gt;, because the tracebacks require pre-compiled bytecode to keep track of the source lines:&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;go&quot;&gt;Python 3.11.0a5 (main, Mar  1 2022, 10:05:02) [GCC 9.3.0] on linux&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;z&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;ZeroDivisionError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;float division by zero&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For more information on error locations in tracebacks, see &lt;a href=&quot;https://www.python.org/dev/peps/pep-0657/&quot;&gt;PEP 657&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;pep-654-exception-groups-and-except&quot;&gt;PEP 654: Exception Groups and &lt;code&gt;except*&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#pep-654-exception-groups-and-except&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-february-2022/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-february-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 #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>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>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>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>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>
  

</feed>
