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

  
    <entry>
      <title>Python Project Management With uv</title>
      <id>https://realpython.com/courses/python-project-management-with-uv/</id>
      <link href="https://realpython.com/courses/python-project-management-with-uv/"/>
      <updated>2025-09-16T14:00:00+00:00</updated>
      <summary>Create and manage Python projects with uv, a blazing-fast package and project manager built in Rust. Learn setup, workflow, and best practices.</summary>
      <content type="html">
        &lt;p&gt;The &lt;code&gt;uv&lt;/code&gt; tool is a high-speed package and project manager for Python. It&amp;rsquo;s written in Rust and designed to streamline your workflow. It offers fast dependency installation and integrates various functionalities into a single tool.&lt;/p&gt;
&lt;p&gt;With &lt;code&gt;uv&lt;/code&gt;, you can install and manage multiple Python versions, create virtual environments, efficiently handle project dependencies, reproduce working environments, and even build and publish a project. These capabilities make &lt;code&gt;uv&lt;/code&gt; an all-in-one tool for Python project management.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;uv&lt;/code&gt; is a Python package and project manager&lt;/strong&gt; that integrates multiple functionalities into one tool, offering a comprehensive solution for managing Python projects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;uv&lt;/code&gt; is used for fast dependency installation&lt;/strong&gt;, virtual environment management, Python version management, and project initialization, enhancing productivity and efficiency.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;uv&lt;/code&gt; can build and publish Python packages&lt;/strong&gt; to package repositories like PyPI, supporting a streamlined process from development to distribution.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;uv&lt;/code&gt; automatically handles virtual environments&lt;/strong&gt;, creating and managing them as needed to ensure clean and isolated project dependencies.&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>What Does -&gt; Mean in Python Function Definitions?</title>
      <id>https://realpython.com/what-does-arrow-mean-in-python/</id>
      <link href="https://realpython.com/what-does-arrow-mean-in-python/"/>
      <updated>2025-09-15T14:00:00+00:00</updated>
      <summary>Wondering what the arrow notation means in Python? Discover how -&gt; is used in type hints, functions, and more, with clear explanations and examples.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In Python, the arrow symbol (&lt;code&gt;-&amp;gt;&lt;/code&gt;) appears in function definitions as a notation to indicate the expected return type. This notation is optional, but when you include it, you clarify what data type a function should return:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_number_of_titles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;titles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;titles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;You may have observed that not all Python code includes this particular syntax. What does the arrow notation mean? In this tutorial, you’ll learn what it is, how to use it, and why its usage sometimes seems so inconsistent.&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 Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/what-does-arrow-mean-in-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-what-does-arrow-mean-in-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that you’ll use to learn what -&amp;gt; means in Python function definitions.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “What Does -&amp;gt; Mean in Python Function Definitions?” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/what-does-arrow-mean-in-python/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ffc973;&quot; alt=&quot;What Does -&amp;gt; Mean in Python Function Definitions?&quot; src=&quot;https://files.realpython.com/media/What-Does---Mean-in-Python-Function-Definitions_Watermarked.09532d39d0e8.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/What-Does---Mean-in-Python-Function-Definitions_Watermarked.09532d39d0e8.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/What-Does---Mean-in-Python-Function-Definitions_Watermarked.09532d39d0e8.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/What-Does---Mean-in-Python-Function-Definitions_Watermarked.09532d39d0e8.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/What-Does---Mean-in-Python-Function-Definitions_Watermarked.09532d39d0e8.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/what-does-arrow-mean-in-python/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;What Does -&amp;gt; Mean in Python Function Definitions?&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your understanding of Python return type hints and learn how to use the -&amp;gt; arrow, annotate containers, and check code with static tools.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;in-short-the-notation-indicates-a-functions-return-type-in-python&quot;&gt;In Short: The &lt;code&gt;-&amp;gt;&lt;/code&gt; Notation Indicates a Function’s Return Type in Python&lt;a class=&quot;headerlink&quot; href=&quot;#in-short-the-notation-indicates-a-functions-return-type-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Python, every value stored in a &lt;a href=&quot;/ref/glossary/variable/&quot; class=&quot;ref-link&quot;&gt;variable&lt;/a&gt; has a &lt;a href=&quot;/ref/glossary/type/&quot; class=&quot;ref-link&quot;&gt;type&lt;/a&gt;. Because Python is dynamically typed, variables themselves don’t have fixed types—they can hold values of any type at different times. This means the same variable might store an &lt;a href=&quot;/ref/builtin-types/int/&quot; class=&quot;ref-link&quot;&gt;integer&lt;/a&gt; at one moment and a &lt;a href=&quot;/ref/builtin-types/str/&quot; class=&quot;ref-link&quot;&gt;string&lt;/a&gt; the next. In contrast, statically typed languages like &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt; require explicit type declarations, and variables are bound to a specific type throughout their lifetime.&lt;/p&gt;
&lt;p&gt;You can see an example of a dynamically typed Python variable in the following code example:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&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;my_number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;32&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;my_number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;32&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;You start by declaring a variable called &lt;code&gt;my_number&lt;/code&gt;, and setting it to the integer value &lt;code&gt;32&lt;/code&gt;. You then change the variable’s value to the string value &lt;code&gt;&quot;32&quot;&lt;/code&gt;. When you run this code in a Python environment, you don’t encounter any problems with the value change.&lt;/p&gt;
&lt;p&gt;Dynamic typing also means you might not always know what data type a Python function will return, if it returns anything at all. Still, it’s often useful to know the return type. To address this, Python 3.5 introduced optional type hints, which allow developers to specify return types. To add a &lt;a href=&quot;/ref/glossary/type-hint/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;type hint&lt;/strong&gt;&lt;/a&gt;, you place a &lt;code&gt;-&amp;gt;&lt;/code&gt; after a function’s parameter list and write the expected return type before the colon.&lt;/p&gt;
&lt;p&gt;You can also add type hints to function parameters. To do this, place a colon after the parameter’s name, followed by the expected type—for example, &lt;a href=&quot;/ref/builtin-types/int/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;int&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;/ref/builtin-types/str/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;str&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;basic-type-hint-examples&quot;&gt;Basic Type Hint Examples&lt;a class=&quot;headerlink&quot; href=&quot;#basic-type-hint-examples&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To further explore type hints, suppose that you’re creating a Python application to manage inventory for a video game store. The program stores a list of game titles, tracks how many copies are in stock, and suggests new games for customers to try.&lt;/p&gt;
&lt;p&gt;You’ve already seen the type hint syntax in the code example introduced earlier, which returns the number of titles in a list of games that the game store carries:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_number_of_titles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;titles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;titles&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;games&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;Dragon Quest&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Final Fantasy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Age of Empires&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Number of titles:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;get_number_of_titles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;games&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Number of titles: 3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;Here you see a type hint. You define a function called &lt;code&gt;get_number_of_titles()&lt;/code&gt;, which takes a list of game titles as input. Next, you add a type hint for the &lt;code&gt;titles&lt;/code&gt; parameter, indicating that the function takes a list of strings. Finally, you also add another type hint for the return type, specifying that the function returns an &lt;a href=&quot;/ref/builtin-types/int/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;int&lt;/code&gt;&lt;/a&gt; value. &lt;/p&gt;
&lt;p&gt;The function returns the length of the list, which is an integer. You test this out in the next line, where you create a variable that stores a list of three game titles. When you invoke the function on the list, you verify that the output is &lt;code&gt;3&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Note that in a real-world application, creating a separate function just to return a list’s length might be redundant. However, for instructional purposes, the function shown in the example is a straightforward way to demonstrate the type hint concept.&lt;/p&gt;
&lt;p&gt;You can use type hints with any Python type. You’ve already seen an example with an &lt;code&gt;int&lt;/code&gt; return type, but consider another example with a &lt;a href=&quot;/ref/builtin-types/str/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;str&lt;/code&gt;&lt;/a&gt; return type. Suppose you want to recommend a random game for a customer to try. You could do so with the following short example function:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/what-does-arrow-mean-in-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/what-does-arrow-mean-in-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Python Project Management With uv</title>
      <id>https://realpython.com/quizzes/python-project-management-with-uv/</id>
      <link href="https://realpython.com/quizzes/python-project-management-with-uv/"/>
      <updated>2025-09-15T12:00:00+00:00</updated>
      <summary>Test your skills with uv, the fast Python project manager. Practice setup, package installs, and key files created by uv.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you will review how to use &lt;a href=&quot;https://realpython.com/courses/python-project-management-with-uv/&quot;&gt;uv&lt;/a&gt;, the high-speed Python package and project manager. You will practice key commands, explore the files uv creates for you, and work with project setup tasks.&lt;/p&gt;
&lt;p&gt;This is a great way to reinforce project management basics with uv and get comfortable with its streamlined workflows.&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>Quiz: What Does -&gt; Mean in Python Function Definitions?</title>
      <id>https://realpython.com/quizzes/what-does-arrow-mean-in-python/</id>
      <link href="https://realpython.com/quizzes/what-does-arrow-mean-in-python/"/>
      <updated>2025-09-15T12:00:00+00:00</updated>
      <summary>Test your understanding of Python return type hints and learn how to use the -&gt; arrow, annotate containers, and check code with static tools.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you will revisit how Python uses the arrow notation (&lt;code&gt;-&amp;gt;&lt;/code&gt;) in function signatures to provide return type hints. Practice identifying correct syntax, annotating containers, and understanding the role of tools like mypy.&lt;/p&gt;
&lt;p&gt;Brush up on key concepts, clarify where and how to use return type hints, and see practical examples in &lt;a href=&quot;https://realpython.com/what-does-arrow-mean-in-python/&quot;&gt;What Does -&amp;gt; Mean in Python Function Definitions?&lt;/a&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #265: Python App Hosting Choices &amp; Documenting Python&#x27;s History</title>
      <id>https://realpython.com/podcasts/rpp/265/</id>
      <link href="https://realpython.com/podcasts/rpp/265/"/>
      <updated>2025-09-12T12:00:00+00:00</updated>
      <summary>What are your options for hosting your Python application or scripts? What are the advantages of a platform as a service, container-based hosts, or setting up a virtual machine? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What are your options for hosting your Python application or scripts? What are the advantages of a platform as a service, container-based hosts, or setting up a virtual machine? Christopher Trudeau is back on the show this week, bringing 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>How to Drop Null Values in pandas</title>
      <id>https://realpython.com/how-to-drop-null-values-in-pandas/</id>
      <link href="https://realpython.com/how-to-drop-null-values-in-pandas/"/>
      <updated>2025-09-10T14:00:00+00:00</updated>
      <summary>Learn how to use .dropna() to drop null values from pandas DataFrames so you can clean missing data and keep your Python analysis accurate.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Missing values can derail your analysis. In pandas, you can use the &lt;code&gt;.dropna()&lt;/code&gt; method to remove rows or columns containing null values—in other words, missing data—so you can work with clean DataFrames. In this tutorial, you’ll learn how this method’s parameters let you control exactly which data gets removed. As you’ll see, these parameters give you fine-grained control over how much of your data to clean.&lt;/p&gt;
&lt;p&gt;Dealing with null values is essential for keeping datasets clean and avoiding the issues they can cause. Missing entries can lead to misinterpreted column data types, inaccurate conclusions, and errors in calculations. Simply put, nulls can cause havoc if they find their way into your calculations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can use &lt;strong&gt;&lt;code&gt;.dropna()&lt;/code&gt;&lt;/strong&gt; to &lt;strong&gt;remove rows and columns&lt;/strong&gt; from a pandas DataFrame.&lt;/li&gt;
&lt;li&gt;You can remove rows and columns based on the &lt;strong&gt;content of a subset&lt;/strong&gt; of your DataFrame.&lt;/li&gt;
&lt;li&gt;You can remove rows and columns based on the &lt;strong&gt;volume of null values&lt;/strong&gt; within your DataFrame.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, it’s recommended that you already have a basic understanding of how to create &lt;a href=&quot;https://realpython.com/pandas-dataframe/&quot;&gt;pandas DataFrames&lt;/a&gt; from files.&lt;/p&gt;
&lt;p&gt;You’ll use the Python &lt;a href=&quot;/ref/glossary/repl/&quot; class=&quot;ref-link&quot;&gt;REPL&lt;/a&gt; along with a file named &lt;code&gt;sales_data_with_missing_values.csv&lt;/code&gt;, which contains several null values you’ll deal with during the exercises. Before you start, extract this file from the downloadable materials by clicking the link at the end of this section. &lt;/p&gt;
&lt;p&gt;The &lt;code&gt;sales_data_with_missing_values.csv&lt;/code&gt; file is based on the publicly available and complete &lt;a href=&quot;https://www.kaggle.com/datasets/satyamanidharv/sales-data-presentation-dashboards?resource=download&quot;&gt;sales data&lt;/a&gt; file from &lt;a href=&quot;https://www.kaggle.com/&quot;&gt;Kaggle&lt;/a&gt;. Understanding the file’s content isn’t essential for this tutorial, but you can explore the Kaggle link above for more details if you’d like.&lt;/p&gt;
&lt;p&gt;You’ll also need to install both the pandas and PyArrow libraries to make sure all code examples work in your environment:&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;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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;span class=&quot;icon baseline text-muted&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pscon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pip&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pyarrow&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&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;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pandas&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pyarrow
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;It’s time to refine your pandas skills by learning how to handle missing data in a variety of ways.&lt;/p&gt;
&lt;p&gt;You’ll find all code examples and the &lt;code&gt;sales_data_with_missing_values.csv&lt;/code&gt; file in the materials for this tutorial, which you can download by clicking the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/how-to-drop-null-values-in-pandas-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-how-to-drop-null-values-in-pandas-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that you’ll use to learn how to drop null values in pandas.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “How to Drop Null Values in pandas” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/how-to-drop-null-values-in-pandas/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&quot;How to Drop Null Values in pandas&quot; src=&quot;https://files.realpython.com/media/How-to-Drop-Null-Values-in-Pandas_Watermarked.f06e0d54bea4.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/How-to-Drop-Null-Values-in-Pandas_Watermarked.f06e0d54bea4.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/How-to-Drop-Null-Values-in-Pandas_Watermarked.f06e0d54bea4.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/How-to-Drop-Null-Values-in-Pandas_Watermarked.f06e0d54bea4.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/How-to-Drop-Null-Values-in-Pandas_Watermarked.f06e0d54bea4.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/how-to-drop-null-values-in-pandas/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;How to Drop Null Values in pandas&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Quiz yourself on pandas .dropna(): remove nulls, clean missing data, and prepare DataFrames for accurate analysis.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;how-to-drop-rows-containing-null-values-in-pandas&quot;&gt;How to Drop Rows Containing Null Values in pandas&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-drop-rows-containing-null-values-in-pandas&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before you start dropping rows, it’s helpful to know what options &lt;code&gt;.dropna()&lt;/code&gt; gives you. This method supports six &lt;strong&gt;parameters&lt;/strong&gt; that let you control exactly what’s removed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;axis&lt;/code&gt;&lt;/strong&gt;: Specifies whether to remove rows or columns containing null values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;thresh&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;how&lt;/code&gt;&lt;/strong&gt;: Define how many missing values to remove or retain.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;subset&lt;/code&gt;&lt;/strong&gt;: Limits the removal of null values to specific parts of your DataFrame.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;inplace&lt;/code&gt;&lt;/strong&gt;: Determines whether the operation modifies the original DataFrame or returns a new copy.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ignore_index&lt;/code&gt;&lt;/strong&gt;: Resets the DataFrame index after removing rows.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Don’t worry if any of these parameters don’t make sense to you just yet—you’ll learn why each is used during this tutorial. You’ll also get the chance to practice your skills.&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; Although this tutorial teaches you how pandas DataFrames use &lt;code&gt;.dropna()&lt;/code&gt;, DataFrames aren’t the only pandas objects that use it.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://pandas.pydata.org/docs/reference/series.html&quot;&gt;Series&lt;/a&gt; objects also have their own &lt;a href=&quot;https://pandas.pydata.org/docs/reference/api/pandas.Series.dropna.html&quot;&gt;&lt;code&gt;.dropna()&lt;/code&gt;&lt;/a&gt; method. However, the Series version contains only four parameters—&lt;code&gt;axis&lt;/code&gt;, &lt;code&gt;inplace&lt;/code&gt;, &lt;code&gt;how&lt;/code&gt;, and &lt;code&gt;ignore_index&lt;/code&gt;—instead of the six supported by the DataFrame version. Of these, only &lt;code&gt;inplace&lt;/code&gt; and &lt;code&gt;ignore_index&lt;/code&gt; are used, and they work the same way as in the DataFrame method. The rest are kept for compatibility with DataFrame, but have no effect.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://pandas.pydata.org/docs/reference/indexing.html&quot;&gt;Indexes&lt;/a&gt; also have a &lt;a href=&quot;https://pandas.pydata.org/docs/reference/api/pandas.Index.dropna.html&quot;&gt;&lt;code&gt;.dropna()&lt;/code&gt;&lt;/a&gt; method for removing missing index values, and it contains just one parameter: &lt;code&gt;how&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Before using &lt;code&gt;.dropna()&lt;/code&gt; to drop rows, you should first find out whether your data contains any &lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;null values&lt;/a&gt;:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;pandas&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;pd&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;pd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;display.max_columns&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;None&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;sales_data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read_csv&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;s2&quot;&gt;&quot;sales_data_with_missing_values.csv&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;parse_dates&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;order_date&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;date_format&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%d&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/%m/%Y&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;convert_dtypes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dtype_backend&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;pyarrow&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;sales_data&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    order_number           order_date       customer_name  \&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0           &amp;lt;NA&amp;gt;  2025-02-09 00:00:00      Skipton Fealty&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1          70041                 &amp;lt;NA&amp;gt;  Carmine Priestnall&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2          70042  2025-02-09 00:00:00                &amp;lt;NA&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3          70043  2025-02-10 00:00:00     Lanni D&#x27;Ambrogi&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4          70044  2025-02-10 00:00:00         Tann Angear&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5          70045  2025-02-10 00:00:00      Skipton Fealty&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;6          70046  2025-02-11 00:00:00             Far Pow&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;7          70047  2025-02-11 00:00:00          Hill Group&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;8          70048  2025-02-11 00:00:00         Devlin Nock&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;9           &amp;lt;NA&amp;gt;                 &amp;lt;NA&amp;gt;                &amp;lt;NA&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;10         70049  2025-02-12 00:00:00           Swift Inc&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;                product_purchased discount  sale_price&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0    Chili Extra Virgin Olive Oil     True       135.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1                            &amp;lt;NA&amp;gt;     &amp;lt;NA&amp;gt;       150.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2       Rosemary Olive Oil Candle    False        78.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3                            &amp;lt;NA&amp;gt;     True        19.5&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4    Vanilla and Olive Oil Candle     &amp;lt;NA&amp;gt;       13.98&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5    Basil Extra Virgin Olive Oil     True        &amp;lt;NA&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;6    Chili Extra Virgin Olive Oil    False       150.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;7    Chili Extra Virgin Olive Oil     True       135.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;8   Lavender and Olive Oil Lotion    False       39.96&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;9                            &amp;lt;NA&amp;gt;     &amp;lt;NA&amp;gt;        &amp;lt;NA&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;10  Garlic Extra Virgin Olive Oil     True       936.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;To make sure all columns appear on your screen, you configure &lt;code&gt;pd.set_option(&quot;display.max_columns&quot;, None)&lt;/code&gt;. By passing &lt;code&gt;None&lt;/code&gt; as the second parameter, you make sure all columns are displayed.&lt;/p&gt;
&lt;p&gt;You read the &lt;code&gt;sales_data_with_missing_values.csv&lt;/code&gt; file into a DataFrame using the &lt;a href=&quot;https://realpython.com/pandas-read-write-files/#read-a-csv-file&quot;&gt;pandas &lt;code&gt;read_csv()&lt;/code&gt;&lt;/a&gt; function, then view the data. The order dates are in the &lt;code&gt;&quot;%d/%m/%Y&quot;&lt;/code&gt; format in the file, so to make sure the &lt;code&gt;order_date&lt;/code&gt; data is read correctly, you use both the &lt;code&gt;parse_dates&lt;/code&gt; and &lt;code&gt;date_format&lt;/code&gt; parameters. The output reveals there are ten rows and six columns of data in your file.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/how-to-drop-null-values-in-pandas/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/how-to-drop-null-values-in-pandas/ »&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>Quiz: How to Drop Null Values in pandas</title>
      <id>https://realpython.com/quizzes/how-to-drop-null-values-in-pandas/</id>
      <link href="https://realpython.com/quizzes/how-to-drop-null-values-in-pandas/"/>
      <updated>2025-09-10T12:00:00+00:00</updated>
      <summary>Quiz yourself on pandas .dropna(): remove nulls, clean missing data, and prepare DataFrames for accurate analysis.</summary>
      <content type="html">
        &lt;p&gt;Challenge yourself with this quiz and see how much you understand about dropping null values in pandas.&lt;/p&gt;
&lt;p&gt;Working through this quiz is a great way to revisit what you learned in the &lt;a href=&quot;https://realpython.com/how-to-drop-null-values-in-pandas/&quot;&gt;How to Drop Null Values in pandas&lt;/a&gt; tutorial. You&amp;rsquo;ll find most of the answers in the tutorial content, but for some of the questions, you might need to do some extra digging.&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 String Splitting</title>
      <id>https://realpython.com/courses/python-string-splitting/</id>
      <link href="https://realpython.com/courses/python-string-splitting/"/>
      <updated>2025-09-09T14:00:00+00:00</updated>
      <summary>Master Python string splitting with .split() and re.split() to handle whitespace, delimiters and multiline text.</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s &lt;code&gt;.split()&lt;/code&gt; method lets you divide a string into a list of substrings based on a specified delimiter. By default, &lt;code&gt;.split()&lt;/code&gt; separates at whitespace, including spaces, tabs, and newlines. You can customize &lt;code&gt;.split()&lt;/code&gt; to work with specific delimiters using the &lt;code&gt;sep&lt;/code&gt; parameter, and control the amount of splits with &lt;code&gt;maxsplit&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You &lt;strong&gt;split a string by spaces&lt;/strong&gt; in Python using &lt;strong&gt;&lt;code&gt;.split()&lt;/code&gt; without arguments&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Python&amp;rsquo;s &lt;code&gt;.split()&lt;/code&gt; method can split on &lt;strong&gt;custom delimiters&lt;/strong&gt; when you pass a character or string as an argument.&lt;/li&gt;
&lt;li&gt;You &lt;strong&gt;limit splits using &lt;code&gt;maxsplit&lt;/code&gt;&lt;/strong&gt; to control the number of substrings Python extracts.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;re.split()&lt;/code&gt; uses &lt;strong&gt;regular expressions&lt;/strong&gt; for splitting strings based on complex patterns.&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Python Documentary Celebrates History While Developer Surveys Celebrate Python</title>
      <id>https://realpython.com/python-news-september-2025/</id>
      <link href="https://realpython.com/python-news-september-2025/"/>
      <updated>2025-09-08T14:00:00+00:00</updated>
      <summary>The Python documentary debuts! Explore Python&#x27;s journey, 2025 survey results, explosive growth, and key September news updates.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python is making history, and headlines. The much-anticipated &lt;strong&gt;&lt;em&gt;Python: The Documentary&lt;/em&gt;&lt;/strong&gt; premiered last month, capturing 34 years of programming history. But Python isn’t just looking back, it’s also moving forward at breakneck speed. &lt;/p&gt;
&lt;p&gt;The recent developer surveys revealed Python’s explosive growth. At the same time, the Python Software Foundation paused its grants program amid unprecedented demand, PyPI implemented multiple security enhancements, while JetBrains announced a transition for PyCharm Community Edition into a unified product model.&lt;/p&gt;
&lt;p&gt;Here’s what’s been happening in the world of Python!&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, or news update.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;the-python-documentary-is-now-available-on-youtube&quot;&gt;The Python Documentary Is Now Available on YouTube&lt;a class=&quot;headerlink&quot; href=&quot;#the-python-documentary-is-now-available-on-youtube&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;At the end of August, &lt;a href=&quot;https://www.youtube.com/watch?v=GfH4QL4VqJ0&quot;&gt;&lt;em&gt;Python: The Documentary&lt;/em&gt;&lt;/a&gt; premiered on YouTube, where you can watch it for free. It’s an 84-minute film tracing Python’s journey from Amsterdam side project to the world’s most popular programming language: &lt;/p&gt;
&lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3&quot;&gt;&lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item rounded&quot; type=&quot;text/html&quot; src=&quot;https://www.youtube.com/embed/GfH4QL4VqJ0?autoplay=1&amp;amp;modestbranding=1&amp;amp;rel=0&amp;amp;showinfo=0&amp;amp;origin=https://realpython.com&quot; frameborder=&quot;0&quot; allowfullscreen allow=&quot;accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture&quot; title=&quot;Embedded video (click to play)&quot; srcdoc=&quot;&amp;lt;style&amp;gt;*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}.play{height:25%;opacity:0.6;};&amp;lt;/style&amp;gt;&amp;lt;a href=&#x27;https://www.youtube.com/embed/GfH4QL4VqJ0?autoplay=1&amp;amp;modestbranding=1&amp;amp;rel=0&amp;amp;showinfo=0&amp;amp;origin=https://realpython.com&#x27;&amp;gt;&amp;lt;img src=&#x27;https://img.youtube.com/vi/GfH4QL4VqJ0/hqdefault.jpg&#x27; alt=&#x27;Video Thumbnail&#x27;&amp;gt;&amp;lt;img class=&#x27;play&#x27; src=&#x27;data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzODQgNTEyIj48cGF0aCBkPSJNNzMgMzljLTE0LjgtOS4xLTMzLjQtOS40LTQ4LjUtLjlTMCA2Mi42IDAgODBWNDMyYzAgMTcuNCA5LjQgMzMuNCAyNC41IDQxLjlzMzMuNyA4LjEgNDguNS0uOUwzNjEgMjk3YzE0LjMtOC43IDIzLTI0LjIgMjMtNDFzLTguNy0zMi4yLTIzLTQxTDczIDM5eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==&#x27;&amp;gt;&amp;lt;/a&amp;gt;&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;

&lt;p&gt;Produced by &lt;a href=&quot;https://www.youtube.com/@cultrepo&quot;&gt;CultRepo (formerly Honeypot)&lt;/a&gt; and directed by Ida Bechtle, the documentary explores Python’s evolution and the community that shaped it. It features &lt;a href=&quot;/ref/glossary/bdfl/&quot; class=&quot;ref-link&quot;&gt;Guido van Rossum&lt;/a&gt; and key contributors like &lt;a href=&quot;https://mariatta.ca/&quot;&gt;Mariatta&lt;/a&gt; and recent &lt;a href=&quot;https://realpython.com/podcasts/rpp/262/&quot;&gt;Real Python Podcast guest, Travis Oliphant&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;The documentary also highlights the important role of &lt;a href=&quot;https://pyladies.com/&quot;&gt;PyLadies&lt;/a&gt; and addresses controversial topics including the Python 2 to 3 transition.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you want to take a deep dive into Python’s version history, then check out &lt;a href=&quot;https://realpython.com/courses/history-python-versions-features/&quot;&gt;A History of Python Versions and Features&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The timing of &lt;em&gt;Python: The Documentary&lt;/em&gt; couldn’t be better. While the film celebrates past achievements, the latest developer surveys show Python continues to thrive.&lt;/p&gt;
&lt;h2 id=&quot;developer-surveys-reveal-pythons-explosive-growth&quot;&gt;Developer Surveys Reveal Python’s Explosive Growth&lt;a class=&quot;headerlink&quot; href=&quot;#developer-surveys-reveal-pythons-explosive-growth&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://blog.jetbrains.com/pycharm/2025/08/the-state-of-python-2025/&quot;&gt;JetBrains The State of Python 2025&lt;/a&gt; and the &lt;a href=&quot;https://stackoverflow.blog/2025/08/01/diving-into-the-results-of-the-2025-developer-survey/?lid=drihiki0rm4n&quot;&gt;Stack Overflow 2025 Developer Survey&lt;/a&gt; revealed Python’s remarkable growth:&lt;/p&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/python_survey_2025_1.0282de628f2e.png&quot; width=&quot;1078&quot; height=&quot;504&quot; srcset=&quot;/cdn-cgi/image/width=269,format=auto/https://files.realpython.com/media/python_survey_2025_1.0282de628f2e.png 269w, /cdn-cgi/image/width=359,format=auto/https://files.realpython.com/media/python_survey_2025_1.0282de628f2e.png 359w, /cdn-cgi/image/width=539,format=auto/https://files.realpython.com/media/python_survey_2025_1.0282de628f2e.png 539w, /cdn-cgi/image/width=1078,format=auto/https://files.realpython.com/media/python_survey_2025_1.0282de628f2e.png 1078w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Screenshot of the SO programming language survey showing Python at 57.9%&quot; data-asset=&quot;6516&quot;&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Image: &lt;a href=&quot;https://survey.stackoverflow.co/2025/technology#most-popular-technologies&quot; target=&quot;_blank&quot;&gt;Most Popular Technologies 2025&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Python usage jumped &lt;strong&gt;seven percentage points&lt;/strong&gt; to reach &lt;strong&gt;57.9%&lt;/strong&gt; of all developers, marking one of the largest year-over-year gains for any established language. Another exciting survey result is that &lt;strong&gt;50%&lt;/strong&gt; of respondents have &lt;strong&gt;two years or less&lt;/strong&gt; of professional coding experience:&lt;/p&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/python_survey_2025_4.43b497b742fb.png&quot; width=&quot;1814&quot; height=&quot;1156&quot; srcset=&quot;/cdn-cgi/image/width=453,format=auto/https://files.realpython.com/media/python_survey_2025_4.43b497b742fb.png 453w, /cdn-cgi/image/width=604,format=auto/https://files.realpython.com/media/python_survey_2025_4.43b497b742fb.png 604w, /cdn-cgi/image/width=907,format=auto/https://files.realpython.com/media/python_survey_2025_4.43b497b742fb.png 907w, /cdn-cgi/image/width=1814,format=auto/https://files.realpython.com/media/python_survey_2025_4.43b497b742fb.png 1814w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Screenshot of the JetBrains surves showing most Python developers are beginners&quot; data-asset=&quot;6520&quot;&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Image: &lt;a href=&quot;https://blog.jetbrains.com/pycharm/2025/08/the-state-of-python-2025/#we-are-mostly-brand-new-programmers&quot; target=&quot;_blank&quot;&gt;Years of Python Experience 2025&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;If you’re one of them and want to get started with Python, then this &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Introduction to Python Learning Path&lt;/a&gt; is perfect for you. One of the positively surprising results of the Stack Overflow survey is that &lt;a href=&quot;https://docs.astral.sh/uv/guides/install-python/&quot;&gt;&lt;code&gt;uv&lt;/code&gt;&lt;/a&gt; came in first place as the &lt;a href=&quot;https://survey.stackoverflow.co/2025/technology#admired-and-desired&quot;&gt;most admired Stack Overflow tag&lt;/a&gt;:&lt;/p&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/python_survey_2025_2.d1bbb217ff84.png&quot; width=&quot;1018&quot; height=&quot;518&quot; srcset=&quot;/cdn-cgi/image/width=254,format=auto/https://files.realpython.com/media/python_survey_2025_2.d1bbb217ff84.png 254w, /cdn-cgi/image/width=339,format=auto/https://files.realpython.com/media/python_survey_2025_2.d1bbb217ff84.png 339w, /cdn-cgi/image/width=509,format=auto/https://files.realpython.com/media/python_survey_2025_2.d1bbb217ff84.png 509w, /cdn-cgi/image/width=1018,format=auto/https://files.realpython.com/media/python_survey_2025_2.d1bbb217ff84.png 1018w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Screenshot of the SO surves showing uv as the most admired tag&quot; data-asset=&quot;6517&quot;&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Image: &lt;a href=&quot;https://survey.stackoverflow.co/2025/technology#admired-and-desired&quot; target=&quot;_blank&quot;&gt;Most Admired Technology Tag 2025&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;If you want to give &lt;code&gt;uv&lt;/code&gt; a spin yourself, then you can check out the tutorials &lt;a href=&quot;https://realpython.com/python-uv/&quot;&gt;Managing Python Projects With uv&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/uv-vs-pip/&quot;&gt;uv vs pip: Managing Python Packages and Dependencies&lt;/a&gt;. Another notable development is &lt;a href=&quot;https://fastapi.tiangolo.com/&quot;&gt;FastAPI’s&lt;/a&gt; jump in usage from &lt;strong&gt;29% to 38%&lt;/strong&gt; among Python developers:&lt;/p&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/python_survey_2025_3.d42078d863e7.png&quot; width=&quot;1814&quot; height=&quot;1108&quot; srcset=&quot;/cdn-cgi/image/width=453,format=auto/https://files.realpython.com/media/python_survey_2025_3.d42078d863e7.png 453w, /cdn-cgi/image/width=604,format=auto/https://files.realpython.com/media/python_survey_2025_3.d42078d863e7.png 604w, /cdn-cgi/image/width=907,format=auto/https://files.realpython.com/media/python_survey_2025_3.d42078d863e7.png 907w, /cdn-cgi/image/width=1814,format=auto/https://files.realpython.com/media/python_survey_2025_3.d42078d863e7.png 1814w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Screenshot of the JetBrains surves showing the rise of FastAPI&quot; data-asset=&quot;6518&quot;&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Image: &lt;a href=&quot;https://blog.jetbrains.com/pycharm/2025/08/the-state-of-python-2025/&quot; target=&quot;_blank&quot;&gt;Web Frameworks Usage 2025&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;

&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-september-2025/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-september-2025/ »&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>Quiz: Sorting Dictionaries in Python: Keys, Values, and More</title>
      <id>https://realpython.com/quizzes/sorting-dictionaries-keys-values-more/</id>
      <link href="https://realpython.com/quizzes/sorting-dictionaries-keys-values-more/"/>
      <updated>2025-09-07T12:00:00+00:00</updated>
      <summary>Test your skills in sorting Python dictionaries by keys and values. Learn about insertion order, dictionary views, and sorting techniques.</summary>
      <content type="html">
        &lt;p&gt;This quiz helps you practice sorting dictionaries by keys, values, and custom rules in modern Python. You&amp;rsquo;ll revisit how insertion order works, when to use different views, and how to rebuild sorted dictionaries.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll also learn best practices for sorting dictionaries efficiently. For a complete overview, check out &lt;a href=&quot;https://realpython.com/courses/sorting-dictionaries-keys-values-more/&quot;&gt;Sorting Dictionaries: Keys, Values, and More&lt;/a&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Defining and Calling Python Functions</title>
      <id>https://realpython.com/quizzes/defining-and-calling-functions/</id>
      <link href="https://realpython.com/quizzes/defining-and-calling-functions/"/>
      <updated>2025-09-07T12:00:00+00:00</updated>
      <summary>Practice defining and calling functions in Python, including parameters, argument types, default values, and function documentation.</summary>
      <content type="html">
        &lt;p&gt;Ready to revisit how Python functions work? In this quiz, you&amp;rsquo;ll practice defining and calling functions, using positional and keyword arguments, managing defaults, and writing docstrings. You&amp;rsquo;ll also get hands-on with collecting extra arguments and enforcing how callers pass them.&lt;/p&gt;
&lt;p&gt;Sharpen your skills by applying the concepts from &lt;a href=&quot;https://realpython.com/courses/defining-and-calling-functions/&quot;&gt;Defining and Calling Functions in Python&lt;/a&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #264: Large Language Models on the Edge of the Scaling Laws</title>
      <id>https://realpython.com/podcasts/rpp/264/</id>
      <link href="https://realpython.com/podcasts/rpp/264/"/>
      <updated>2025-09-05T12:00:00+00:00</updated>
      <summary>What&#x27;s happening with the latest releases of large language models? Is the industry hitting the edge of the scaling laws, and do the current benchmarks provide reliable performance assessments? This week on the show, Jodie Burchell returns to discuss the current state of LLM releases.</summary>
      <content type="html">
        &lt;p&gt;What&#x27;s happening with the latest releases of large language models? Is the industry hitting the edge of the scaling laws, and do the current benchmarks provide reliable performance assessments? This week on the show, Jodie Burchell returns to discuss the current state of LLM releases.&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>uv vs pip: Managing Python Packages and Dependencies</title>
      <id>https://realpython.com/uv-vs-pip/</id>
      <link href="https://realpython.com/uv-vs-pip/"/>
      <updated>2025-09-03T14:00:00+00:00</updated>
      <summary>Compare uv vs pip with benchmarks, speed tests, and dependency management tips. Learn which tool is best for your Python projects.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;When it comes to Python package managers, the choice often comes down to &lt;code&gt;uv&lt;/code&gt; vs &lt;code&gt;pip&lt;/code&gt;. You may choose &lt;code&gt;pip&lt;/code&gt; for out-of-the-box availability, broad compatibility, and reliable ecosystem support. In contrast, &lt;code&gt;uv&lt;/code&gt; is worth considering if you prioritize fast installs, reproducible environments, and clean uninstall behavior, or if you want to streamline workflows for new projects.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll compare both tools. To keep this comparison meaningful, you’ll focus on the overlapping features, primarily &lt;em&gt;package installation&lt;/em&gt; and &lt;em&gt;dependency management&lt;/em&gt;. The decision table below can help you quickly choose between the two:&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;Use Case&lt;/th&gt;
&lt;th class=&quot;text-center&quot;&gt;&lt;code&gt;uv&lt;/code&gt;&lt;/th&gt;
&lt;th class=&quot;text-center&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;You need a tool with reliable ecosystem support&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;—&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;You need reproducible, locked environments&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Choosing the right package installer can greatly affect your workflow as a Python developer. In this tutorial, you’ll compare &lt;code&gt;uv&lt;/code&gt; and &lt;code&gt;pip&lt;/code&gt;, explore their overlapping features, and learn how to pick the right tool for your project’s goals.&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 Your Cheat Sheet:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/uv-vs-pip-cheatsheet/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-uv-vs-pip-cheatsheet&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the uv vs pip cheat sheet&lt;/a&gt; that will help you decide which tool to use.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “uv vs pip: Managing Python Packages and Dependencies” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/uv-vs-pip/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&quot;uv vs pip: Managing Python Packages and Dependencies&quot; src=&quot;https://files.realpython.com/media/uv-vs-pip-for-Managing-Python-Packages_Watermarked.1ae41cbbc7b6.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/uv-vs-pip-for-Managing-Python-Packages_Watermarked.1ae41cbbc7b6.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/uv-vs-pip-for-Managing-Python-Packages_Watermarked.1ae41cbbc7b6.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/uv-vs-pip-for-Managing-Python-Packages_Watermarked.1ae41cbbc7b6.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/uv-vs-pip-for-Managing-Python-Packages_Watermarked.1ae41cbbc7b6.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/uv-vs-pip/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;uv vs pip: Managing Python Packages and Dependencies&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your knowledge of uv vs pip as Python package managers and learn how to pick the right tool for speed, reproducibility, and compatibility.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;metrics-comparison-uv-vs-pip&quot;&gt;Metrics Comparison: &lt;code&gt;uv&lt;/code&gt; vs &lt;code&gt;pip&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#metrics-comparison-uv-vs-pip&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To help you quickly see where &lt;a href=&quot;https://docs.astral.sh/uv/&quot;&gt;&lt;code&gt;uv&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://pip.pypa.io/en/stable/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; differ, the table below summarizes their strengths and trade-offs in package installation and dependency management:&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;Metric&lt;/th&gt;
&lt;th&gt;&lt;code&gt;uv&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Out-of-the-Box Availability&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Package installation speed&lt;/td&gt;
&lt;td&gt;Installs &lt;a href=&quot;https://realpython.com/using-jupyterlab/&quot;&gt;JupyterLab&lt;/a&gt; in 2.618 seconds&lt;/td&gt;
&lt;td&gt;Installs JupyterLab in 21.409 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reproducible installs&lt;/td&gt;
&lt;td&gt;Supports reproducible installs based on native locking&lt;/td&gt;
&lt;td&gt;Supports &lt;a href=&quot;https://realpython.com/what-is-pip/#using-requirements-files&quot;&gt;&lt;code&gt;requirements.txt&lt;/code&gt;&lt;/a&gt; and needs &lt;code&gt;pip-tools&lt;/code&gt; for reproducibility&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Removal of transitive dependencies&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maturity and ecosystem support&lt;/td&gt;
&lt;td&gt;New and growing, adoption increasing&lt;/td&gt;
&lt;td&gt;Mature, standard tool in the Python ecosystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Licensing&lt;/td&gt;
&lt;td&gt;MIT license&lt;/td&gt;
&lt;td&gt;MIT license&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Supporting organization&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://astral.sh/about&quot;&gt;Astral&lt;/a&gt;, a private company focused on high-performance developer tools for Python&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.pypa.io/en/latest/&quot;&gt;Python Packaging Authority (PyPA)&lt;/a&gt;, an official part of the &lt;a href=&quot;/ref/glossary/psf/&quot; class=&quot;ref-link&quot;&gt;Python Software Foundation (PSF)&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;After this quick summary, you’ll run a more detailed analysis to learn more about the intricacies of each specific metric or feature.&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; To learn more about &lt;code&gt;pip&lt;/code&gt; and &lt;code&gt;uv&lt;/code&gt; in general, you can check out these tutorials:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;Using Python’s &lt;code&gt;pip&lt;/code&gt; to Manage Your Projects’ Dependencies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-uv/&quot;&gt;Managing Python Projects With uv: An All-in-One Solution&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;In the following sections, you’ll explore these metrics one by one and run a few benchmarks to help you compare both tools and decide which one better suits your specific needs.&lt;/p&gt;
&lt;h2 id=&quot;out-of-the-box-availability&quot;&gt;Out-of-the-Box Availability&lt;a class=&quot;headerlink&quot; href=&quot;#out-of-the-box-availability&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One big reason &lt;code&gt;pip&lt;/code&gt; remains dominant is that it ships with Python. This means that if you install Python with the official &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;CPython&lt;/a&gt; installer, then you’ll have &lt;code&gt;pip&lt;/code&gt; available out of the box and can use it to install packages with no extra step:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;requests
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;Once you’ve installed Python, you can use &lt;code&gt;pip&lt;/code&gt; immediately without installing additional tools. This is convenient when you don’t have the appropriate permissions to install new software on your work computer.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; On Ubuntu and Debian, the default Python installation often includes the &lt;code&gt;python3&lt;/code&gt; package, but may not include &lt;code&gt;pip&lt;/code&gt;. If it’s missing, then you can install it by running &lt;code&gt;sudo apt install python3-pip&lt;/code&gt; in your terminal window.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;On the other hand, &lt;code&gt;uv&lt;/code&gt; requires an extra installation step. You can install it using the standalone installer by running the command below:&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;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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;span class=&quot;icon baseline text-muted&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pscon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;powershell&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-ExecutionPolicy&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ByPass&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;irm https://astral.sh/uv/install.ps1 | iex&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&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;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;curl&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-LsSf&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;https://astral.sh/uv/install.sh&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This additional setup might not be a problem for you, but it can be a blocker if you don’t have the appropriate permissions to install apps in your working environment. Fortunately, &lt;code&gt;uv&lt;/code&gt; has other &lt;a href=&quot;https://docs.astral.sh/uv/getting-started/installation/&quot;&gt;installation options&lt;/a&gt; that you can use to install it in your user space.&lt;/p&gt;
&lt;h2 id=&quot;package-installation-speed&quot;&gt;Package Installation Speed&lt;a class=&quot;headerlink&quot; href=&quot;#package-installation-speed&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here’s where &lt;code&gt;uv&lt;/code&gt; really shines compared to &lt;code&gt;pip&lt;/code&gt;. Written in &lt;a href=&quot;https://www.rust-lang.org/&quot;&gt;Rust&lt;/a&gt; and designed for speed, &lt;code&gt;uv&lt;/code&gt; can install packages faster than &lt;code&gt;pip&lt;/code&gt;. This is especially true when you’re working on projects with large dependency trees.&lt;/p&gt;
&lt;p&gt;Coming up next, you’ll see how &lt;code&gt;uv&lt;/code&gt; and &lt;code&gt;pip&lt;/code&gt; compare for installing packages and managing dependencies.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-the-environment&quot;&gt;Setting Up the Environment&lt;a class=&quot;headerlink&quot; href=&quot;#setting-up-the-environment&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/uv-vs-pip/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/uv-vs-pip/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: uv vs pip: Managing Python Packages and Dependencies</title>
      <id>https://realpython.com/quizzes/uv-vs-pip/</id>
      <link href="https://realpython.com/quizzes/uv-vs-pip/"/>
      <updated>2025-09-03T12:00:00+00:00</updated>
      <summary>Test your knowledge of uv vs pip as Python package managers and learn how to pick the right tool for speed, reproducibility, and compatibility.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/uv-vs-pip/&quot;&gt;uv vs pip: Managing Python Packages and Dependencies&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With this knowledge, you&amp;rsquo;ll be able to confidently choose between pip, the default and widely supported package installer, and uv, the newer modern project manager. You&amp;rsquo;ll dig into install speeds, locking mechanisms, dependency management, and the implications for different environments and workflows.&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>A History of Python Versions and Features</title>
      <id>https://realpython.com/courses/history-python-versions-features/</id>
      <link href="https://realpython.com/courses/history-python-versions-features/"/>
      <updated>2025-09-02T14:00:00+00:00</updated>
      <summary>Explore Python’s evolution from the 1990s to today with a brief history and demos of key features added throughout its lifetime.</summary>
      <content type="html">
        &lt;p&gt;This course gives you a direct, practical overview of how Python has evolved&amp;mdash;what changed in each major version, why it matters, and how to use the features that define modern Python. You&amp;rsquo;ll see both the historical context and hands-on code, so you understand not just what changed, but why and how to use it today.&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;Key new features introduced in every major Python version, starting from early Python 1 up to Python 3.14&lt;/li&gt;
&lt;li&gt;The story behind pivotal changes, like list comprehensions, exception handling, the &lt;code&gt;with&lt;/code&gt; statement, &lt;code&gt;defaultdict&lt;/code&gt;, and the transition from Python 2 to Python 3&lt;/li&gt;
&lt;li&gt;Hands-on use of modern Python tools: f-strings, dataclasses, the walrus operator (:=), match/case structural pattern matching, and new types like enum and pathlib&lt;/li&gt;
&lt;li&gt;How to leverage improvements in each Python release for cleaner, faster, and more maintainable code&lt;/li&gt;
&lt;li&gt;What&amp;rsquo;s coming in the latest Python releases, including t-strings and REPL improvements&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>Quiz: Python String Splitting</title>
      <id>https://realpython.com/quizzes/python-string-splitting/</id>
      <link href="https://realpython.com/quizzes/python-string-splitting/"/>
      <updated>2025-09-02T12:00:00+00:00</updated>
      <summary>Practice Python string splitting, from whitespace handling to using custom separators and regex. Review split(), rsplit(), and edge cases.</summary>
      <content type="html">
        &lt;p&gt;Ready to brush up on Python&amp;rsquo;s string splitting skills? This quiz will help you practice how to use &lt;code&gt;split()&lt;/code&gt;, handle whitespace, manage delimiters, and even tackle trickier patterns with regex.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll get hands-on with &lt;code&gt;maxsplit&lt;/code&gt;, explore differences between &lt;code&gt;split()&lt;/code&gt; and &lt;code&gt;rsplit()&lt;/code&gt;, and see how to handle edge cases. For a deeper dive, check out the &lt;a href=&quot;https://realpython.com/courses/python-string-splitting/&quot;&gt;Real Python course on string splitting&lt;/a&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Managing Multiple Python Versions With pyenv</title>
      <id>https://realpython.com/intro-to-pyenv/</id>
      <link href="https://realpython.com/intro-to-pyenv/"/>
      <updated>2025-09-01T14:00:00+00:00</updated>
      <summary>Learn how to use pyenv to manage multiple Python versions, prevent conflicts, and keep your projects compatible and development smooth.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;code&gt;pyenv&lt;/code&gt; command-line tool allows you to install and switch between multiple Python versions without interfering with your operating system’s Python installation. This enables you to test code across different interpreters and manage project-specific requirements.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn how to install and set up &lt;code&gt;pyenv&lt;/code&gt;, manage multiple Python versions, and create virtual environments to work on your coding projects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Python, &lt;strong&gt;&lt;code&gt;pyenv&lt;/code&gt;&lt;/strong&gt; is a command-line tool for managing &lt;strong&gt;multiple Python versions&lt;/strong&gt; independently of your system installation.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;difference&lt;/strong&gt; between &lt;strong&gt;&lt;code&gt;pyenv&lt;/code&gt;&lt;/strong&gt; and the &lt;strong&gt;&lt;code&gt;venv&lt;/code&gt;&lt;/strong&gt; module is that &lt;code&gt;pyenv&lt;/code&gt; allows you to manage multiple Python versions and virtual environments, while &lt;code&gt;venv&lt;/code&gt; allows you to create virtual environments based on a single Python version.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;pyenv&lt;/code&gt; helps you avoid conflicts with your &lt;strong&gt;system Python&lt;/strong&gt;, freely install &lt;strong&gt;any Python version&lt;/strong&gt; you need, and quickly &lt;strong&gt;switch between versions&lt;/strong&gt; for different projects or tests.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Discover how &lt;code&gt;pyenv&lt;/code&gt; helps you manage multiple Python versions to prevent conflicts, streamline development, and ensure version compatibility across projects.&lt;/p&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Managing Multiple Python Versions With pyenv” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/intro-to-pyenv/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #fe7e73;&quot; alt=&quot;Managing Multiple Python Versions With pyenv&quot; src=&quot;https://files.realpython.com/media/UPDATE-Managing-Multiple-Python-Versions-with-pyenv_Watermarked.4a8dbe20f88e.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/UPDATE-Managing-Multiple-Python-Versions-with-pyenv_Watermarked.4a8dbe20f88e.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/UPDATE-Managing-Multiple-Python-Versions-with-pyenv_Watermarked.4a8dbe20f88e.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/UPDATE-Managing-Multiple-Python-Versions-with-pyenv_Watermarked.4a8dbe20f88e.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/UPDATE-Managing-Multiple-Python-Versions-with-pyenv_Watermarked.4a8dbe20f88e.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/intro-to-pyenv/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Managing Multiple Python Versions With pyenv&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your knowledge of pyenv with this quiz and see how well you can manage multiple Python versions, virtual environments, and dependencies.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&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 Your Cheat Sheet:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/intro-to-pyenv-cheatsheet/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-intro-to-pyenv-cheatsheet&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download a free cheat sheet&lt;/a&gt; that shows you how to use pyenv to manage multiple versions of Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-the-benefits-of-using-pyenv&quot;&gt;Understanding the Benefits of Using &lt;code&gt;pyenv&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-the-benefits-of-using-pyenv&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;pyenv&lt;/code&gt; tool is designed to manage multiple Python versions in a clean way. Even if you already have Python installed on your operating system, it’s worth having &lt;code&gt;pyenv&lt;/code&gt; installed so that you can keep the system Python installation clean and, more importantly, contribute to projects that use a different version of Python.&lt;/p&gt;
&lt;p&gt;The question arises: &lt;em&gt;Why would I use &lt;code&gt;pyenv&lt;/code&gt; if I already have Python installed on my operating system (OS)?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;system Python installation&lt;/strong&gt; is the Python interpreter that’s installed directly on your operating system. You’ll typically have a default system Python installation on macOS or Linux. On Windows, you may need to &lt;a href=&quot;https://realpython.com/installing-python/&quot;&gt;install Python&lt;/a&gt; manually.&lt;/p&gt;
&lt;p&gt;So, why not use the system’s Python installation for your day-to-day coding? One way to look at it is that this Python &lt;em&gt;belongs&lt;/em&gt; to the operating system. In many cases, the OS relies on the preinstalled Python to operate. This means that some OS components may depend on a specific Python version to work correctly. If you change the system Python version or some of the preinstalled packages, you could break the OS itself.&lt;/p&gt;
&lt;p&gt;In addition, you may not have much control over what version of Python you can install on your OS. If you want to use the latest features of Python, and you’re on Ubuntu, for example, then you might be out of luck. The available versions might be too old, which means you’ll have to wait for a new OS release to come out. Unfortunately, another Python version can appear in that process, and you’ll never be up to date.&lt;/p&gt;
&lt;p&gt;Another issue appears when you install third-party packages on the system Python using the &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; command or a similar tool. In this case, you’re installing the Python package globally, which can be a problem if another user—or yourself—wants to install a different version of the package to work on a different project. You can’t have multiple versions of the same package installed in a given Python environment.&lt;/p&gt;
&lt;p&gt;For example, if you have version 1.1.0 of a given package and install version 1.2.0, you’ll be replacing the first one. This might seem harmless. However, projects that depend on the older version can stop working with the new version.&lt;/p&gt;
&lt;p&gt;A critical issue arises when you have multiple projects requiring different Python versions. The system Python installation is often unique. If you update Python, then some projects may stop working. If you don’t update it, then more recent projects may not be able to use the new features of Python.&lt;/p&gt;
&lt;p&gt;Finally, on most operating systems, you need administrative privileges to install a different Python version or third-party packages. This requirement can be a real obstacle in company environments with strict security rules. In short, using the system Python installation comes with some major drawbacks. It can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Break parts of the &lt;strong&gt;operating system&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Prevent you from using the &lt;strong&gt;latest Python versions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Cause issues in projects that require &lt;strong&gt;older Python versions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Block projects that rely on &lt;strong&gt;new Python features&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Require the &lt;strong&gt;intervention of a third person&lt;/strong&gt; when you need to install something&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ideally, you want more flexibility and safety when you use Python for software development. For example, you might need to do some of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install Python in &lt;strong&gt;your user space&lt;/strong&gt; so you don’t depend on system administrators&lt;/li&gt;
&lt;li&gt;Install, manage, and uninstall &lt;strong&gt;multiple Python versions&lt;/strong&gt; freely&lt;/li&gt;
&lt;li&gt;Specify the &lt;strong&gt;exact Python version&lt;/strong&gt; you want to use in each project&lt;/li&gt;
&lt;li&gt;Switch between the &lt;strong&gt;installed versions&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The good news is that &lt;code&gt;pyenv&lt;/code&gt; lets you do all these things. It’s also a great way to &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;install pre-release versions of Python&lt;/a&gt;, so you can try out new language features or test the release for bugs.&lt;/p&gt;
&lt;h2 id=&quot;installing-pyenv&quot;&gt;Installing &lt;code&gt;pyenv&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#installing-pyenv&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before you install and use &lt;code&gt;pyenv&lt;/code&gt; on Linux or macOS, you may need to fulfill some OS-specific dependencies. These dependencies are mostly development utilities written in &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C&lt;/a&gt; that &lt;code&gt;pyenv&lt;/code&gt; uses to build Python from source. On the other hand, Windows users set things up differently, as you’ll soon discover.&lt;/p&gt;
&lt;p&gt;For a more detailed breakdown and explanation of the build dependencies, you can check out &lt;a href=&quot;https://devguide.python.org/setup/#build-dependencies&quot;&gt;Python Developer’s Guide&lt;/a&gt;. In this tutorial, you’ll learn the most common ways to install these dependencies.&lt;/p&gt;
&lt;h3 id=&quot;preparing-linux-systems-for-pyenv&quot;&gt;Preparing Linux Systems for &lt;code&gt;pyenv&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#preparing-linux-systems-for-pyenv&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/intro-to-pyenv/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/intro-to-pyenv/ »&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>Quiz: Managing Multiple Python Versions With pyenv</title>
      <id>https://realpython.com/quizzes/intro-to-pyenv/</id>
      <link href="https://realpython.com/quizzes/intro-to-pyenv/"/>
      <updated>2025-09-01T12:00:00+00:00</updated>
      <summary>Test your knowledge of pyenv with this quiz and see how well you can manage multiple Python versions, virtual environments, and dependencies.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/intro-to-pyenv/&quot;&gt;Managing Multiple Python Versions With pyenv&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll revisit how to install multiple versions of Python and switch between the installed versions.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #263: Exploring Mixin Classes in Python</title>
      <id>https://realpython.com/podcasts/rpp/263/</id>
      <link href="https://realpython.com/podcasts/rpp/263/"/>
      <updated>2025-08-29T12:00:00+00:00</updated>
      <summary>What is a good way to add isolated, reusable functionality to Python classes? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What is a good way to add isolated, reusable functionality to Python classes? Christopher Trudeau is back on the show this week, bringing 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>Quiz: Deep vs Shallow Copies in Python</title>
      <id>https://realpython.com/quizzes/deep-vs-shallow-copies/</id>
      <link href="https://realpython.com/quizzes/deep-vs-shallow-copies/"/>
      <updated>2025-08-29T12:00:00+00:00</updated>
      <summary>Test your understanding of deep and shallow copying in Python. Review assignment, identity, and how to copy complex objects correctly.</summary>
      <content type="html">
        &lt;p&gt;Ready to reinforce your knowledge of deep and shallow copies in Python? This quiz covers assignment semantics, object identity, and how to properly copy nested and user-defined objects. You will also practice writing your own copy helpers and customizing class copying.&lt;/p&gt;
&lt;p&gt;Brush up on these essential concepts before you start by reviewing &lt;a href=&quot;https://realpython.com/courses/deep-vs-shallow-copies/&quot;&gt;Deep vs Shallow Copies in Python&lt;/a&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Exploring Python Closures: Examples and Use Cases</title>
      <id>https://realpython.com/quizzes/closures-examples-use-cases/</id>
      <link href="https://realpython.com/quizzes/closures-examples-use-cases/"/>
      <updated>2025-08-29T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python closures. Closures are a common feature in functional programming languages and are particularly popular in Python because they allow you to create function-based decorators.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of Python closures. Closures are a common feature in functional programming languages and are particularly popular in Python because they allow you to create function-based decorators.&lt;/p&gt;
&lt;p&gt;Take this quiz after taking our &lt;a href=&quot;https://realpython.com/courses/closures-examples-use-cases/&quot;&gt;Exploring Python Closures: Examples and Use Cases&lt;/a&gt; course.&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.14 Preview: Lazy Annotations</title>
      <id>https://realpython.com/python-annotations/</id>
      <link href="https://realpython.com/python-annotations/"/>
      <updated>2025-08-27T14:00:00+00:00</updated>
      <summary>Explore how Python 3.14&#x27;s lazy evaluation of annotations boosts performance, fixes chronic type hinting issues, and unlocks powerful new runtime uses.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Recent Python releases have introduced several small improvements to the type hinting system, but Python 3.14 brings a single major change: lazy annotations. This change delays annotation evaluation until explicitly requested, improving performance and resolving issues with forward references. Library maintainers might need to adapt, but for regular Python users, this change promises a simpler and faster development experience.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Although &lt;strong&gt;annotations&lt;/strong&gt; are used primarily for &lt;strong&gt;type hinting&lt;/strong&gt; in Python, they support both static type checking and runtime metadata processing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lazy annotations&lt;/strong&gt; in Python 3.14 defer evaluation until needed, enhancing performance and reducing startup time.&lt;/li&gt;
&lt;li&gt;Lazy annotations address issues with &lt;strong&gt;forward references&lt;/strong&gt;, allowing types to be defined later.&lt;/li&gt;
&lt;li&gt;You can access annotations via the &lt;strong&gt;&lt;code&gt;.__annotations__&lt;/code&gt;&lt;/strong&gt; attribute or use &lt;strong&gt;&lt;code&gt;annotationlib.get_annotations()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;typing.get_type_hints()&lt;/code&gt;&lt;/strong&gt; for more robust introspection.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;typing.Annotated&lt;/code&gt;&lt;/strong&gt; enables combining type hints with metadata, facilitating both static type checking and runtime processing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Explore how lazy annotations in Python 3.14 streamline your development process, offering both performance benefits and enhanced code clarity. If you’re just looking for a brief overview of the key changes in 3.14, then expand the collapsible section below:&lt;/p&gt;
&lt;div class=&quot;card mb-3&quot; id=&quot;collapse_card681068&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;#collapse681068&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;collapse681068&quot; markdown=&quot;1&quot;&gt;&lt;span class=&quot;float-left&quot; markdown=&quot;1&quot;&gt;What&#x27;s New in Python 3.14: A Quick Summary&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_card681068&quot; id=&quot;collapse681068&quot;&gt;
&lt;div class=&quot;card-body&quot;&gt;
&lt;p&gt;Python 3.14 introduces &lt;strong&gt;lazy evaluation of annotations&lt;/strong&gt;, solving long-standing pain points with type hints. Here’s what you need to know:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Annotations are no longer evaluated at definition time. Instead, their processing is deferred until you explicitly access them.&lt;/li&gt;
&lt;li&gt;Forward references work out of the box without needing string literals or &lt;code&gt;from __future__ import annotations&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Circular imports are no longer an issue for type hints because annotations don’t trigger immediate name resolution.&lt;/li&gt;
&lt;li&gt;Startup performance improves, especially for modules with expensive annotation expressions.&lt;/li&gt;
&lt;li&gt;Standard tools, such as &lt;code&gt;typing.get_type_hints()&lt;/code&gt; and &lt;code&gt;inspect.get_annotations()&lt;/code&gt;, still work but now benefit from the new evaluation strategy.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;inspect.get_annotations()&lt;/code&gt; becomes deprecated in favor of the enhanced &lt;code&gt;annotationlib.get_annotations()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can now request annotations at runtime in alternative formats, including strings, values, and proxy objects that safely handle forward references.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These changes make type hinting faster, safer, and easier to use, mostly without breaking backward compatibility.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&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 Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-annotations-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-annotations-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code &lt;/a&gt; that shows you how to use lazy annotations in Python 3.14.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Python Annotations” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-annotations/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #fe7e73;&quot; alt=&quot;Python 3.14 Preview: Lazy Annotations&quot; src=&quot;https://files.realpython.com/media/Python-3.14-Preview-Lazy-Annotations-PEP-649.aae06a71abf4.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Python-3.14-Preview-Lazy-Annotations-PEP-649.aae06a71abf4.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Python-3.14-Preview-Lazy-Annotations-PEP-649.aae06a71abf4.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Python-3.14-Preview-Lazy-Annotations-PEP-649.aae06a71abf4.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Python-3.14-Preview-Lazy-Annotations-PEP-649.aae06a71abf4.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-annotations/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Annotations&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your knowledge of annotations and type hints, including how different Python versions evaluate them at runtime.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;python-annotations-in-a-nutshell&quot;&gt;Python Annotations in a Nutshell&lt;a class=&quot;headerlink&quot; href=&quot;#python-annotations-in-a-nutshell&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before diving into what’s changed in &lt;strong&gt;Python 3.14&lt;/strong&gt; regarding annotations, it’s a good idea to review some of the terminology surrounding annotations. In the next sections, you’ll learn the difference between annotations and type hints, and review some of their most common use cases. If you’re already familiar with these concepts, then skip straight to &lt;a href=&quot;#lazy-evaluation-of-annotations-in-python-314&quot;&gt;lazy evaluation of annotations&lt;/a&gt; for details on how the new annotation processing works.&lt;/p&gt;
&lt;h3 id=&quot;annotations-vs-type-hints&quot;&gt;Annotations vs Type Hints&lt;a class=&quot;headerlink&quot; href=&quot;#annotations-vs-type-hints&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Arguably, &lt;a href=&quot;/ref/glossary/type-hint/&quot; class=&quot;ref-link&quot;&gt;type hints&lt;/a&gt; are the most common use case for &lt;a href=&quot;/ref/glossary/annotation/&quot; class=&quot;ref-link&quot;&gt;annotations&lt;/a&gt; in Python today. However, annotations are a more general-purpose feature with broader applications. They’re a form of syntactic &lt;a href=&quot;https://en.wikipedia.org/wiki/Metadata&quot;&gt;metadata&lt;/a&gt; that you can optionally attach to your Python &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Although annotations can convey arbitrary information, they must follow the language’s syntax rules. In other words, you won’t be able to define an annotation representing a piece of syntactically incorrect Python code.&lt;/p&gt;
&lt;p&gt;To be even more precise, annotations must be valid Python &lt;a href=&quot;/ref/glossary/expression/&quot; class=&quot;ref-link&quot;&gt;expressions&lt;/a&gt;, such as string literals, arithmetic operations, or even function calls. On the other hand, annotations can’t be simple or compound &lt;a href=&quot;/ref/glossary/statement/&quot; class=&quot;ref-link&quot;&gt;statements&lt;/a&gt; that aren’t expressions, like &lt;a href=&quot;https://realpython.com/python-assignment-operator/&quot;&gt;assignments&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditionals&lt;/a&gt;, because those might have unintended &lt;a href=&quot;https://en.wikipedia.org/wiki/Side_effect_(computer_science)&quot;&gt;side effects&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; For a deeper explanation of the difference between these two constructs, check out &lt;a href=&quot;https://realpython.com/python-expression-vs-statement/&quot;&gt;Expression vs Statement in Python: What’s the Difference?&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Python supports two flavors of annotations, as specified in &lt;a href=&quot;https://peps.python.org/pep-3107/&quot;&gt;PEP 3107&lt;/a&gt; and &lt;a href=&quot;https://peps.python.org/pep-0526/&quot;&gt;PEP 526&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Function annotations:&lt;/strong&gt; Metadata attached to signatures of &lt;a href=&quot;/ref/glossary/callable/&quot; class=&quot;ref-link&quot;&gt;callable objects&lt;/a&gt;, including functions and &lt;a href=&quot;https://realpython.com/instance-class-and-static-methods-demystified/&quot;&gt;methods&lt;/a&gt;—but not &lt;a href=&quot;https://realpython.com/python-lambda/&quot;&gt;lambda functions&lt;/a&gt;, which don’t support the annotation syntax.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Variable annotations:&lt;/strong&gt; Metadata attached to local, &lt;a href=&quot;/ref/keywords/nonlocal/&quot; class=&quot;ref-link&quot;&gt;nonlocal&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-use-global-variable-in-function/&quot;&gt;global variables&lt;/a&gt;, as well as class and instance &lt;a href=&quot;/ref/glossary/attribute/&quot; class=&quot;ref-link&quot;&gt;attributes&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The syntax for function and variable annotations looks almost identical, except that functions support additional notation for specifying their &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;return value&lt;/a&gt;. Below is the official syntax for both types of annotations in Python. Note that &lt;code&gt;&amp;lt;annotation&amp;gt;&lt;/code&gt; is a placeholder, and you don’t need the angle brackets when replacing this placeholder with the actual annotation:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python_syntax&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python Syntax&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;Python 3.6+&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Class&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# These two could be either class or instance attributes:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;attribute1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;attribute2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;method&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;parameter1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;parameter2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;parameter3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default_value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;parameter4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;default_value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instance_attribute1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;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;instance_attribute2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;parameter1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;parameter2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;parameter3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default_value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;parameter4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;default_value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;variable1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;variable2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;To annotate a variable, attribute, or function parameter, put a colon (&lt;code&gt;:&lt;/code&gt;) just after its name, followed by the annotation itself. Conversely, to annotate a function’s return value, place the right arrow (&lt;code&gt;-&amp;gt;&lt;/code&gt;) symbol after the closing parenthesis of the parameter list. The return annotation goes between that arrow and the colon denoting the start of the function’s body. &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 right arrow symbol isn’t unique to Python. A few other programming languages use it as well but for different purposes. For example, &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt; and &lt;a href=&quot;https://coffeescript.org/&quot;&gt;CoffeeScript&lt;/a&gt; use it to define anonymous functions, similar to Python’s lambdas. This symbol is sometimes referred to as the &lt;em&gt;thin&lt;/em&gt; arrow (&lt;code&gt;-&amp;gt;&lt;/code&gt;) to distinguish it from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fat_comma&quot;&gt;fat arrow (&lt;code&gt;=&amp;gt;&lt;/code&gt;)&lt;/a&gt; found in &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt; and &lt;a href=&quot;https://www.scala-lang.org/&quot;&gt;Scala&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;As shown, you can mix and match function and method parameters, including &lt;a href=&quot;https://realpython.com/python-optional-arguments/&quot;&gt;optional parameters&lt;/a&gt;, with or without annotations. You can also annotate a variable without assigning it a value, effectively making a &lt;a href=&quot;https://en.wikipedia.org/wiki/Declaration_(computer_programming)&quot;&gt;declaration&lt;/a&gt; of an &lt;a href=&quot;/ref/glossary/identifier/&quot; class=&quot;ref-link&quot;&gt;identifier&lt;/a&gt; that might be defined later.&lt;/p&gt;
&lt;p&gt;Declaring a variable doesn’t allocate memory for its storage or even register it in the current &lt;a href=&quot;https://realpython.com/python-namespace/&quot;&gt;namespace&lt;/a&gt;. Still, it can be useful for communicating the expected type to other people reading your code or a &lt;a href=&quot;/ref/glossary/static-type-checker/&quot; class=&quot;ref-link&quot;&gt;static type checker&lt;/a&gt;. Another common use case is instructing the &lt;a href=&quot;/ref/glossary/interpreter/&quot; class=&quot;ref-link&quot;&gt;Python interpreter&lt;/a&gt; to generate &lt;a href=&quot;https://en.wikipedia.org/wiki/Boilerplate_code&quot;&gt;boilerplate code&lt;/a&gt; on your behalf, such as when working with &lt;a href=&quot;/ref/glossary/data-class/&quot; class=&quot;ref-link&quot;&gt;data classes&lt;/a&gt;. You’ll explore these scenarios in the next section.&lt;/p&gt;
&lt;p&gt;To give you a better idea of what Python annotations might look like in practice, below are concrete examples of syntactically correct variable annotations:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;Python 3.6+&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&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;temperature&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;float&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;pressure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;unit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;kPa&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;min&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;220&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;max&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;270&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;You annotate the variable &lt;code&gt;temperature&lt;/code&gt; with &lt;a href=&quot;/ref/builtin-types/float/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;float&lt;/code&gt;&lt;/a&gt; to indicate its expected type. For the variable &lt;code&gt;pressure&lt;/code&gt;, you use a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;Python dictionary&lt;/a&gt; to specify the air pressure unit along with its minimum and maximum values. This kind of metadata could be used to validate the actual value at runtime, &lt;a href=&quot;https://realpython.com/documenting-python-code/&quot;&gt;generate documentation&lt;/a&gt; based on the source code, or even automatically &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;build a command-line interface&lt;/a&gt; for a &lt;a href=&quot;https://realpython.com/python-script-structure/&quot;&gt;Python script&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-annotations/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-annotations/ »&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>Profiling Performance in Python</title>
      <id>https://realpython.com/courses/profiling-performance/</id>
      <link href="https://realpython.com/courses/profiling-performance/"/>
      <updated>2025-08-26T14:00:00+00:00</updated>
      <summary>Learn to profile Python programs with built-in and popular third-party tools, and turn performance insights into faster code.</summary>
      <content type="html">
        &lt;p&gt;Do you want to optimize the performance of your Python program to make it run faster or consume less memory? Before diving into any performance tuning, you should strongly consider using a technique called &lt;strong&gt;software profiling&lt;/strong&gt;. It can help you decide whether optimizing the code is necessary and, if so, which parts of the code you should focus on.&lt;/p&gt;
&lt;p&gt;Sometimes, the return on investment in performance optimizations just isn&amp;rsquo;t worth the effort. If you only run your code once or twice, or if it takes longer to improve the code than execute it, then what&amp;rsquo;s the point?&lt;/p&gt;
&lt;p&gt;When it comes to improving the quality of your code, you&amp;rsquo;ll probably optimize for performance as a final step, if you do it at all. Often, your code will become speedier and more memory efficient thanks to other changes that you make. When in doubt, go through this short checklist to figure out whether to work on performance:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/tutorials/testing/&quot;&gt;Testing&lt;/a&gt;: Have you tested your code to prove that it works as expected and without errors?&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-refactoring/&quot;&gt;Refactoring&lt;/a&gt;: Does your code need some cleanup to become more maintainable and &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;Pythonic&lt;/a&gt;?&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-timer/#finding-bottlenecks-in-your-code-with-profilers&quot;&gt;Profiling&lt;/a&gt;: Have you identified the most inefficient parts of your code?&lt;/li&gt;
&lt;/ol&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Write Docstrings in Python</title>
      <id>https://realpython.com/how-to-write-docstrings-in-python/</id>
      <link href="https://realpython.com/how-to-write-docstrings-in-python/"/>
      <updated>2025-08-25T14:00:00+00:00</updated>
      <summary>Learn to write effective Python docstrings that clearly and professionally document your code using best practices and built-in conventions.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Writing clear, consistent docstrings in Python helps others understand your code’s purpose, parameters, and outputs. In this guide on how to write docstrings in Python, you’ll learn about best practices, standard formats, and common pitfalls to avoid, ensuring your documentation is accessible to users and tools alike.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Docstrings are strings used to &lt;strong&gt;document your Python code&lt;/strong&gt; and can be accessed at runtime.&lt;/li&gt;
&lt;li&gt;Python &lt;strong&gt;comments and docstrings&lt;/strong&gt; have important differences.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;One-line&lt;/strong&gt; and &lt;strong&gt;multiline docstrings&lt;/strong&gt; are classifications of docstrings.&lt;/li&gt;
&lt;li&gt;Common docstring formats include &lt;strong&gt;reStructuredText&lt;/strong&gt;, &lt;strong&gt;Google-style&lt;/strong&gt;, &lt;strong&gt;NumPy-style&lt;/strong&gt;, and &lt;strong&gt;doctest-style&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Antipatterns&lt;/strong&gt; such as inconsistent formatting &lt;strong&gt;should be avoided&lt;/strong&gt; when writing docstrings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Explore the following sections to see concrete examples and detailed explanations for crafting effective docstrings in your Python projects.&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 Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/how-to-write-docstrings-in-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-how-to-write-docstrings-in-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code &lt;/a&gt; that shows you how to write docstrings in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “How to Write Docstrings in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/how-to-write-docstrings-in-python/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ffc973;&quot; alt=&quot;How to Write Docstrings in Python&quot; src=&quot;https://files.realpython.com/media/How-to-Write-Docstrings-in-Python.e9dd7ff14ce7.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/How-to-Write-Docstrings-in-Python.e9dd7ff14ce7.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/How-to-Write-Docstrings-in-Python.e9dd7ff14ce7.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/How-to-Write-Docstrings-in-Python.e9dd7ff14ce7.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/How-to-Write-Docstrings-in-Python.e9dd7ff14ce7.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/how-to-write-docstrings-in-python/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;How to Write Docstrings in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your knowledge of Python docstrings, including syntax, conventions, formats, and how to access and generate documentation.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-docstrings-in-python&quot;&gt;Getting Started With Docstrings in Python&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-docstrings-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python &lt;a href=&quot;/ref/glossary/docstring/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;docstrings&lt;/strong&gt;&lt;/a&gt; are string literals that show information regarding Python functions, classes, methods, and modules, allowing them to be properly documented. They are placed immediately after the definition line in triple double quotes (&lt;code&gt;&quot;&quot;&quot;&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Their use and convention are described in &lt;a href=&quot;https://peps.python.org/pep-0257/&quot;&gt;PEP 257&lt;/a&gt;, which is a &lt;a href=&quot;/ref/glossary/pep/&quot; class=&quot;ref-link&quot;&gt;Python Enhancement Proposal (PEP)&lt;/a&gt; that outlines conventions for writing docstrings. Docstrings don’t follow a strict formal style. Here’s an example:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;docstring_format.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;determine_magic_level&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;magic_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Multiply a wizard&#x27;s favorite number by 3 to reveal their magic level.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    &quot;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;magic_number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;Docstrings are a built-in means of documentation. While this may remind you of &lt;a href=&quot;https://realpython.com/python-comments-guide/&quot;&gt;comments in Python&lt;/a&gt;, docstrings serve a distinct purpose. If you’re curious and would like to see a quick breakdown of the differences now, open the collapsible section below.&lt;/p&gt;
&lt;div class=&quot;card mb-3&quot; id=&quot;collapse_card810779&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;#collapse810779&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;collapse810779&quot; markdown=&quot;1&quot;&gt;&lt;span class=&quot;float-left&quot; markdown=&quot;1&quot;&gt;Differences Between Python Comments and Docstrings&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_card810779&quot; id=&quot;collapse810779&quot;&gt;
&lt;div class=&quot;card-body&quot;&gt;
&lt;p&gt;Python comments and docstrings seem a lot alike, but they’re actually quite different in a number of ways because they serve different purposes:&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;Comments&lt;/th&gt;
&lt;th&gt;Docstrings&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Begin with &lt;code&gt;#&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Are enclosed in triple quotes (&lt;code&gt;&quot;&quot;&quot;&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Consist of notes and reminders written by developers for other developers&lt;/td&gt;
&lt;td&gt;Provide documentation for users and tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Are ignored by the Python interpreter&lt;/td&gt;
&lt;td&gt;Are stored in &lt;code&gt;.__doc__&lt;/code&gt; and accessible at runtime&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can be placed anywhere in code&lt;/td&gt;
&lt;td&gt;Are placed at the start of modules, classes, and functions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;To summarize, comments explain parts of an implementation that may not be obvious or that record important notes for other developers. Docstrings describe modules, classes, and functions so users and tools can access that information at runtime.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;So, while comments and docstrings may look similar at first glance, their purpose and behavior in Python are different. Next, you’ll look at one-line and multiline docstrings.&lt;/p&gt;
&lt;h3 id=&quot;one-line-vs-multiline-docstrings&quot;&gt;One-Line vs Multiline Docstrings&lt;a class=&quot;headerlink&quot; href=&quot;#one-line-vs-multiline-docstrings&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Docstrings are generally classified as either one-line or multiline. As the names suggest, one-line docstrings take up only a single line, while multiline docstrings span more than one line. While this may appear to be a slight difference, how you use and format them in your code matters.&lt;/p&gt;
&lt;p&gt;An important formatting rule from PEP 257 is that one-line docstrings should be concise, while multiline docstrings should have their closing quotes on a new line. You may resort to a one-line docstring for relatively straightforward programs like the one below:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;one_line_docstring.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;random&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;picking_hat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Return a random house name.&quot;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;houses&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;Gryffindor&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Hufflepuff&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Ravenclaw&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Slytherin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;choice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;houses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;In this example, you see a program that returns a random house as depicted in the classic Harry Potter stories. This is a good example for the use of one-line docstrings.&lt;/p&gt;
&lt;p&gt;You use multiline docstrings when you have to provide a more thorough explanation of your code, which is helpful for other developers. Generally, a docstring should contain parameters, return value details, and a summary of the code. &lt;/p&gt;
&lt;p&gt;You’re free to format docstrings as you like. That being said, you’ll learn later that there are common docstring formats that you may follow. Here’s an example of a multiline docstring:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;multiline_docstring.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_harry_potter_book&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;publication_year&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Retrieve a Harry Potter book by its publication year and name.&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;    Parameters:&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    publication_year (int): The year the book was published.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    title (str): The title of the book.&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;    Returns:&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    str: A sentence describing the book and its publication year.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    &quot;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;The book &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;!r}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; was published in the year &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;publication_year&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;As you can see, the closing quotes for this multiline docstring appear on a separate line. Now that you understand the difference between one-line and multiline docstrings, you’ll learn how to access docstrings in your code.&lt;/p&gt;
&lt;h3 id=&quot;ways-to-access-docstrings-in-python&quot;&gt;Ways to Access Docstrings in Python&lt;a class=&quot;headerlink&quot; href=&quot;#ways-to-access-docstrings-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Unlike code &lt;a href=&quot;/ref/glossary/comment/&quot; class=&quot;ref-link&quot;&gt;comments&lt;/a&gt;, docstrings aren’t ignored by the interpreter. They become a part of the program and serve as associated documentation for anyone who wants to understand your program and what it does. That’s why knowing how to access docstrings is so useful. Python provides two built-in ways to access docstrings: the &lt;strong&gt;&lt;code&gt;.__doc__&lt;/code&gt; attribute&lt;/strong&gt; and the &lt;strong&gt;&lt;code&gt;help()&lt;/code&gt; function&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;the-__doc__-attribute&quot;&gt;The &lt;code&gt;.__doc__&lt;/code&gt; Attribute&lt;a class=&quot;headerlink&quot; href=&quot;#the-__doc__-attribute&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/how-to-write-docstrings-in-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/how-to-write-docstrings-in-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #262: Travis Oliphant: SciPy, NumPy, and Fostering Scientific Python</title>
      <id>https://realpython.com/podcasts/rpp/262/</id>
      <link href="https://realpython.com/podcasts/rpp/262/"/>
      <updated>2025-08-22T12:00:00+00:00</updated>
      <summary>What went into developing the open-source Python tools data scientists use every day? This week on the show, we talk with Travis Oliphant about his work on SciPy, NumPy, Numba, and many other contributions to the Python scientific community.</summary>
      <content type="html">
        &lt;p&gt;What went into developing the open-source Python tools data scientists use every day? This week on the show, we talk with Travis Oliphant about his work on SciPy, NumPy, Numba, and many other contributions to the Python scientific community.&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 JSON Data in Python</title>
      <id>https://realpython.com/python-json/</id>
      <link href="https://realpython.com/python-json/"/>
      <updated>2025-08-20T14:00:00+00:00</updated>
      <summary>Learn how to work with JSON data in Python using the json module. Convert, read, write, and validate JSON files and handle JSON data for APIs and storage.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;code&gt;json&lt;/code&gt; module provides you with the tools you need to effectively handle JSON data. You can convert Python data types to a JSON-formatted string with &lt;code&gt;json.dumps()&lt;/code&gt; or write them to files using &lt;code&gt;json.dump()&lt;/code&gt;. Similarly, you can read JSON data from files with &lt;code&gt;json.load()&lt;/code&gt; and parse JSON strings with &lt;code&gt;json.loads()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;JSON, or JavaScript Object Notation, is a widely-used text-based format for data interchange. Its syntax resembles Python dictionaries but with some differences, such as using only double quotes for strings and lowercase for Boolean values. With built-in tools for validating syntax and manipulating JSON files, Python makes it straightforward to work with JSON data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;JSON in Python is handled using the &lt;strong&gt;standard-library &lt;code&gt;json&lt;/code&gt; module&lt;/strong&gt;, which allows for &lt;strong&gt;data interchange&lt;/strong&gt; between JSON and Python data types.&lt;/li&gt;
&lt;li&gt;JSON is a good data format to use with Python as it’s &lt;strong&gt;human-readable&lt;/strong&gt; and straightforward to &lt;strong&gt;serialize and deserialize&lt;/strong&gt;, which makes it ideal for use in &lt;strong&gt;APIs and data storage&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You write JSON with Python using &lt;strong&gt;&lt;code&gt;json.dump()&lt;/code&gt;&lt;/strong&gt; to serialize data to a file.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;minify and prettify JSON&lt;/strong&gt; using Python’s &lt;code&gt;json.tool&lt;/code&gt; module.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since its introduction, &lt;a href=&quot;https://en.wikipedia.org/wiki/JSON&quot;&gt;JSON&lt;/a&gt; has rapidly emerged as the predominant standard for the exchange of information. Whether you want to transfer data with an &lt;a href=&quot;https://realpython.com/api-integration-in-python/&quot;&gt;API&lt;/a&gt; or store information in a &lt;a href=&quot;https://realpython.com/introduction-to-mongodb-and-python/&quot;&gt;document database&lt;/a&gt;, it’s likely you’ll encounter JSON. Fortunately, Python provides robust tools to facilitate this process and help you manage JSON data efficiently.&lt;/p&gt;
&lt;p&gt;While JSON is the most common format for data distribution, it’s not the only option for such tasks. Both &lt;a href=&quot;https://realpython.com/python-xml-parser/&quot;&gt;XML&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-yaml/&quot;&gt;YAML&lt;/a&gt; serve similar purposes. If you’re interested in how the formats differ, then you can check out the tutorial on how to &lt;a href=&quot;https://realpython.com/python-serialize-data/&quot;&gt;serialize your data with Python&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-json/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-json&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to work with JSON data in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Working With JSON Data in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-json/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ff7e74;&quot; alt=&quot;Working With JSON Data in Python&quot; src=&quot;https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-json/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Working With JSON Data in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of working with JSON in Python. By working through this quiz, you&#x27;ll revisit key concepts related to JSON data manipulation and handling in Python.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;introducing-json&quot;&gt;Introducing JSON&lt;a class=&quot;headerlink&quot; href=&quot;#introducing-json&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The acronym &lt;strong&gt;JSON&lt;/strong&gt; stands for &lt;a href=&quot;https://www.json.org/&quot;&gt;JavaScript Object Notation&lt;/a&gt;. As the name suggests, JSON originated from &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt;. However, JSON has transcended its origins to become language-agnostic and is now recognized as the &lt;a href=&quot;https://tools.ietf.org/html/rfc8259&quot;&gt;standard&lt;/a&gt; for &lt;strong&gt;data interchange&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The popularity of JSON can be attributed to native support by the JavaScript language, resulting in excellent parsing performance in web browsers. On top of that, JSON’s straightforward syntax allows both humans and computers to read and write JSON data effortlessly.&lt;/p&gt;
&lt;p&gt;To get a first impression of JSON, have a look at this example code:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;json&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--purple&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;JSON&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;hello_world.json&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;greeting&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, world!&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;You’ll learn more about the JSON syntax later in this tutorial. For now, recognize that the JSON format is &lt;strong&gt;text-based&lt;/strong&gt;. In other words, you can create JSON files using the code editor of your choice. Once you set the file extension to &lt;code&gt;.json&lt;/code&gt;, most code editors display your JSON data with syntax highlighting out of the box:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png 1920w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Editor screenshot with code highlighting for a JSON file&quot; data-asset=&quot;5839&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;The screenshot above shows how &lt;a href=&quot;https://realpython.com/python-development-visual-studio-code/&quot;&gt;VS Code&lt;/a&gt; displays JSON data using the &lt;a href=&quot;https://marketplace.visualstudio.com/items?itemName=BeardedBear.beardedtheme&quot;&gt;Bearded color theme&lt;/a&gt;. You’ll have a closer look at the syntax of the JSON format next!&lt;/p&gt;
&lt;h3 id=&quot;examining-json-syntax&quot;&gt;Examining JSON Syntax&lt;a class=&quot;headerlink&quot; href=&quot;#examining-json-syntax&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In the previous section, you got a first impression of how JSON data looks. And as a Python developer, the JSON structure probably reminds you of &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;common Python data structures&lt;/a&gt;, like a dictionary that contains a string as a key and a value. If you understand the syntax of a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt; in Python, you already know the general syntax of a &lt;strong&gt;JSON object&lt;/strong&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; Later in this tutorial, you’ll learn that you’re free to use lists and other data types at the top level of a JSON document.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The similarity between Python dictionaries and JSON objects is no surprise. One idea behind establishing JSON as the go-to data interchange format was to make working with JSON as convenient as possible, independently of which programming language you use:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[A collection of key-value pairs and arrays] are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangeable with programming languages is also based on these structures. (&lt;a href=&quot;https://www.json.org/json-en.html&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To explore the JSON syntax further, create a new file named &lt;code&gt;hello_frieda.json&lt;/code&gt; and add a more complex JSON structure as the content of the file:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;json&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--purple&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;JSON&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;hello_frieda.json&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;linenos&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Frieda&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;isDog&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;hobbies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;eating&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sleeping&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;barking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;age&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 6&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;address&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 7&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;work&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 8&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;home&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Berlin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Germany&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 9&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;friends&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Philipp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;hobbies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;eating&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sleeping&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;reading&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Mitch&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;hobbies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;running&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;snacking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;In the code above, you see data about a dog named Frieda, which is formatted as JSON. The top-level value is a JSON object. Just like Python dictionaries, you wrap JSON objects inside curly braces (&lt;code&gt;{}&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;In line 1, you start the JSON object with an opening curly brace (&lt;code&gt;{&lt;/code&gt;), and then you close the object at the end of line 20 with a closing curly brace (&lt;code&gt;}&lt;/code&gt;).&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-json/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-json/ »&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>Deep vs Shallow Copies in Python</title>
      <id>https://realpython.com/courses/deep-vs-shallow-copies/</id>
      <link href="https://realpython.com/courses/deep-vs-shallow-copies/"/>
      <updated>2025-08-19T14:00:00+00:00</updated>
      <summary>Understand the difference between shallow and deep copies in Python. Learn how to duplicate objects safely using the copy module and other techniques.</summary>
      <content type="html">
        &lt;p&gt;When working with Python objects, you&amp;rsquo;ll often need to make copies rather than modify the originals. In this video course, you&amp;rsquo;ll explore various ways to copy objects in Python, including using the built-in &lt;code&gt;copy&lt;/code&gt; module. You&amp;rsquo;ll also learn the key differences between shallow and deep copies, with practical examples so you can safely duplicate objects in your own code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Shallow copying&lt;/strong&gt; creates a new object but references the same nested objects, leading to shared changes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deep copying&lt;/strong&gt; recursively duplicates all objects, ensuring full independence from the original.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python&amp;rsquo;s &lt;code&gt;copy&lt;/code&gt; module&lt;/strong&gt; provides the &lt;code&gt;copy()&lt;/code&gt; function for shallow copies and &lt;code&gt;deepcopy()&lt;/code&gt; for deep copies.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Custom classes&lt;/strong&gt; can implement &lt;code&gt;.__copy__()&lt;/code&gt; and &lt;code&gt;.__deepcopy__()&lt;/code&gt; for specific copying behavior.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Assignment in Python&lt;/strong&gt; binds variable names to objects without copying, unlike some lower-level languages.&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>Single and Double Underscores in Python Names</title>
      <id>https://realpython.com/python-double-underscore/</id>
      <link href="https://realpython.com/python-double-underscore/"/>
      <updated>2025-08-18T14:00:00+00:00</updated>
      <summary>Learn Python naming conventions with single and double underscores to design APIs, create safe classes, and prevent name clashes.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python has a few naming conventions that are based on using either a single or double underscore character (&lt;code&gt;_&lt;/code&gt;). These conventions allow you to differentiate between public and non-public names in APIs, write subclasses safely, prevent name collisions, and more.&lt;/p&gt;
&lt;p&gt;Following these conventions makes your code look more Pythonic and consistent to other developers. This skill is especially helpful when you’re working on collaborative projects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Underscores&lt;/strong&gt; in Python names &lt;strong&gt;indicate intent&lt;/strong&gt;: a single leading underscore signals a &lt;strong&gt;non-public name&lt;/strong&gt;, a single trailing underscore helps avoid &lt;strong&gt;naming conflicts&lt;/strong&gt;, and a double leading underscore triggers &lt;strong&gt;name mangling&lt;/strong&gt; for class attributes and methods.&lt;/li&gt;
&lt;li&gt;Python doesn’t enforce &lt;strong&gt;public&lt;/strong&gt; or &lt;strong&gt;private&lt;/strong&gt; names with access restrictions. It relies on naming conventions, where &lt;strong&gt;public names&lt;/strong&gt; have no underscores and &lt;strong&gt;non-public names&lt;/strong&gt; start with a single underscore.&lt;/li&gt;
&lt;li&gt;Python’s &lt;strong&gt;name mangling&lt;/strong&gt; automatically renames attributes or methods with double leading underscores by &lt;strong&gt;prefixing them with the class name&lt;/strong&gt;, helping you avoid accidental overrides in subclasses.&lt;/li&gt;
&lt;li&gt;Double leading and trailing underscores—known as &lt;strong&gt;dunders&lt;/strong&gt;—denote &lt;strong&gt;special methods&lt;/strong&gt; or &lt;strong&gt;attributes&lt;/strong&gt;, such as &lt;code&gt;.__init__()&lt;/code&gt;, &lt;code&gt;.__len__()&lt;/code&gt;, and &lt;code&gt;__name__&lt;/code&gt;, which Python uses to support internal behaviors.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll explore practical examples of these naming conventions, learn when and why to use each one, and understand their effects on code readability, API design, and inheritance.&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 Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-double-underscore-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-double-underscore-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to use single and double underscores in Python names.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Single and Double Underscores in Python Names” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-double-underscore/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #e5c5ac;&quot; alt=&quot;Single and Double Underscores in Python Names&quot; src=&quot;https://files.realpython.com/media/Single-and-a-Double-Leading-Underscore-in-Python-Names_Watermarked.e3bfbf1b525c.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Single-and-a-Double-Leading-Underscore-in-Python-Names_Watermarked.e3bfbf1b525c.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Single-and-a-Double-Leading-Underscore-in-Python-Names_Watermarked.e3bfbf1b525c.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Single-and-a-Double-Leading-Underscore-in-Python-Names_Watermarked.e3bfbf1b525c.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Single-and-a-Double-Leading-Underscore-in-Python-Names_Watermarked.e3bfbf1b525c.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-double-underscore/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Single and Double Underscores in Python Names&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of the use of single and double underscores in Python names. This knowledge will help you differentiate between public and non-public names, avoid name clashes, and write code that looks Pythonic and consistent.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;public-interfaces-and-naming-conventions-in-python&quot;&gt;Public Interfaces and Naming Conventions in Python&lt;a class=&quot;headerlink&quot; href=&quot;#public-interfaces-and-naming-conventions-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As a Python programmer, you’ll frequently work with &lt;strong&gt;public interfaces&lt;/strong&gt;, known as &lt;a href=&quot;/ref/glossary/api/&quot; class=&quot;ref-link&quot;&gt;application programming interfaces (APIs)&lt;/a&gt;. An API is a type of programming interface that offers a service to other parts of a program or other programs.&lt;/p&gt;
&lt;p&gt;For example, the Python &lt;a href=&quot;/ref/glossary/standard-library/&quot; class=&quot;ref-link&quot;&gt;standard library&lt;/a&gt; has many &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;modules and packages&lt;/a&gt; that provide certain services. To use these &lt;a href=&quot;/ref/glossary/module/&quot; class=&quot;ref-link&quot;&gt;modules&lt;/a&gt; and &lt;a href=&quot;/ref/glossary/package/&quot; class=&quot;ref-link&quot;&gt;packages&lt;/a&gt;, you need to access their &lt;a href=&quot;/ref/glossary/public-name/&quot; class=&quot;ref-link&quot;&gt;&lt;em&gt;public&lt;/em&gt;&lt;/a&gt; components, such as &lt;a href=&quot;/ref/glossary/class/&quot; class=&quot;ref-link&quot;&gt;classes&lt;/a&gt;, &lt;a href=&quot;/ref/glossary/function/&quot; class=&quot;ref-link&quot;&gt;functions&lt;/a&gt;, &lt;a href=&quot;/ref/glossary/variable/&quot; class=&quot;ref-link&quot;&gt;variables&lt;/a&gt;, constants, and modules. All these &lt;a href=&quot;/ref/glossary/object/&quot; class=&quot;ref-link&quot;&gt;objects&lt;/a&gt; are part of the module or package’s public interface. They’re available for you to use directly in your code.&lt;/p&gt;
&lt;p&gt;However, many of these packages and modules define objects that aren’t intended for direct access. These objects are meant for internal use within the specific package or module and aren’t part of its public interface.&lt;/p&gt;
&lt;p&gt;In the context of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;, languages like &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; have the notion of &lt;strong&gt;public&lt;/strong&gt; and &lt;strong&gt;private&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/python-classes/#providing-behavior-with-methods&quot;&gt;methods&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-classes/#attaching-data-to-classes-and-instances&quot;&gt;attributes&lt;/a&gt;—jointly called &lt;strong&gt;members&lt;/strong&gt;. In these languages, you can use these types of class members as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Public&lt;/strong&gt;: You can use them in your own code or client code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Private&lt;/strong&gt;: You can use them only from inside the defining class and its subclasses.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These languages have specific keywords and syntax to define public and private members in their classes. Once you declare a member as private, you can’t use it outside the class because the language restricts access. So, private members aren’t part of the class’s public interface, and there’s no way to access them.&lt;/p&gt;
&lt;p&gt;In contrast, Python doesn’t have the notion of public and private members. It has neither dedicated &lt;a href=&quot;https://realpython.com/python-keywords/&quot;&gt;keywords&lt;/a&gt; nor syntax for defining them. Therefore, you can always access the members of a Python class.&lt;/p&gt;
&lt;p&gt;If Python doesn’t have a specific syntax to define when an object is part of a public interface, then how do you tell your users that they &lt;em&gt;can&lt;/em&gt; or &lt;em&gt;can’t&lt;/em&gt; use a given class, method, function, variable, constant, or even module in their code?&lt;/p&gt;
&lt;p&gt;To approach this question, the Python community has a well-established &lt;strong&gt;naming convention&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;If a name starts with a letter in uppercase or lowercase, then you should consider that name public and, therefore, part of the code’s API. In contrast, if a name starts with an underscore character (&lt;code&gt;_&lt;/code&gt;), then you should consider that name non-public, meaning it’s not a part of the public API.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You should observe these naming conventions to explicitly indicate whether other developers should directly use your variables, constants, functions, methods, and modules in external code.&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 naming convention doesn’t restrict access to objects. It only signals to other developers how the code is intended to be used. Because of this, Python programmers avoid the terms public and private. Instead, they distinguish between &lt;a href=&quot;/ref/glossary/public-name/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;public&lt;/strong&gt;&lt;/a&gt; and &lt;a href=&quot;/ref/glossary/non-public-name/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;non-public (internal)&lt;/strong&gt;&lt;/a&gt; names.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The Python community uses the underscore character (&lt;code&gt;_&lt;/code&gt;) as part of other naming conventions. Here’s a summary of what &lt;a href=&quot;https://peps.python.org/pep-0008/&quot;&gt;PEP 8&lt;/a&gt; says about using this character in names:&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;Convention&lt;/th&gt;
&lt;th&gt;Example&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;Single leading underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;_variable&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Indicates that the name is meant for internal use only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Single trailing underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;class_&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Avoids naming conflicts with Python keywords and built-in names&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Double leading underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;__attribute&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Triggers name mangling in the context of Python classes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Double leading and trailing underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;__name__&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Indicates special attributes and methods that Python provides&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Single underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;_&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Indicates a temporary or throwaway variable&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Note that only two of these &lt;a href=&quot;https://realpython.com/python-pep8/#naming-conventions&quot;&gt;naming conventions&lt;/a&gt; enforce specific Python behaviors. Using double leading underscores triggers &lt;strong&gt;name mangling&lt;/strong&gt; in Python classes. You’ll learn more about this behavior in the section on &lt;a href=&quot;#double-leading-underscore-in-classes-pythons-name-mangling&quot;&gt;name mangling&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Additionally, those names with double leading and trailing underscores that are listed in the Python &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html&quot;&gt;data model&lt;/a&gt; trigger internal behaviors in specific contexts. You’ll also learn more about this topic in the section on &lt;a href=&quot;#dunder-names-in-python&quot;&gt;dunder names in Python&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; Python also treats a single &lt;a href=&quot;/ref/keywords/underscore/&quot; class=&quot;ref-link&quot;&gt;underscore (&lt;code&gt;_&lt;/code&gt;)&lt;/a&gt; as a &lt;a href=&quot;/ref/glossary/soft-keyword/&quot; class=&quot;ref-link&quot;&gt;soft keyword&lt;/a&gt; within &lt;code&gt;match&lt;/code&gt; … &lt;code&gt;case&lt;/code&gt; statements. You’ll learn more about this &lt;a href=&quot;#other-uses-of-underscores-in-python&quot;&gt;later&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-double-underscore/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-double-underscore/ »&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 #261: Selecting Inheritance or Composition in Python</title>
      <id>https://realpython.com/podcasts/rpp/261/</id>
      <link href="https://realpython.com/podcasts/rpp/261/"/>
      <updated>2025-08-15T12:00:00+00:00</updated>
      <summary>When considering an object-oriented programming problem, should you prefer inheritance or composition? Why wouldn&#x27;t it just be simpler to use functions? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;When considering an object-oriented programming problem, should you prefer inheritance or composition? Why wouldn&#x27;t it just be simpler to use functions? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s with Statement: Manage External Resources Safely</title>
      <id>https://realpython.com/python-with-statement/</id>
      <link href="https://realpython.com/python-with-statement/"/>
      <updated>2025-08-13T14:00:00+00:00</updated>
      <summary>Understand Python&#x27;s with statement and context managers to streamline the setup and teardown phases in resource management. Start writing safer code today!</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;a href=&quot;/ref/keywords/with/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;with&lt;/code&gt;&lt;/a&gt; statement allows you to manage external resources safely by using objects that support the context manager protocol. These objects automatically handle the setup and cleanup phases of common operations.&lt;/p&gt;
&lt;p&gt;By using the &lt;code&gt;with&lt;/code&gt; statement alongside appropriate context managers, you can focus on your core logic while the context managers prevent resource leaks like unclosed files, unreleased memory, or dangling network connections.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python’s &lt;strong&gt;&lt;code&gt;with&lt;/code&gt; statement&lt;/strong&gt; automates the process of setting up and tearing down computational resources using context managers.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;with&lt;/code&gt; reduces code complexity and &lt;strong&gt;prevents resource leaks&lt;/strong&gt; by ensuring proper resource release, even if exceptions occur.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;context manager&lt;/strong&gt; in Python is an object that implements &lt;strong&gt;&lt;code&gt;.__enter__()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;.__exit__()&lt;/code&gt;&lt;/strong&gt; methods to manage resources safely.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Get ready to learn how Python’s &lt;code&gt;with&lt;/code&gt; statement and context managers streamline the setup and teardown phases of resource management so you can write safer, more reliable code.&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 Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-with-statement-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-with-statement-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to use Python’s with statement to manage external resources safely.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Context Managers and Python&#x27;s with Statement” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-with-statement/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&quot;Context Managers and Python&#x27;s with Statement&quot; src=&quot;https://files.realpython.com/media/Context-Managers--the-Python-with-Statement_Watermarked.3774ffbe2514.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Context-Managers--the-Python-with-Statement_Watermarked.3774ffbe2514.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Context-Managers--the-Python-with-Statement_Watermarked.3774ffbe2514.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Context-Managers--the-Python-with-Statement_Watermarked.3774ffbe2514.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Context-Managers--the-Python-with-Statement_Watermarked.3774ffbe2514.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-with-statement/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Context Managers and Python&#x27;s with Statement&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your knowledge of Python&#x27;s with statement and context managers to write cleaner code and manage resources safely and efficiently.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;managing-external-resources-in-python&quot;&gt;Managing External Resources in Python&lt;a class=&quot;headerlink&quot; href=&quot;#managing-external-resources-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Properly managing &lt;strong&gt;external resources&lt;/strong&gt;, such as &lt;a href=&quot;https://realpython.com/working-with-files-in-python/&quot;&gt;files&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Lock_(computer_science)&quot;&gt;locks&lt;/a&gt;, and network connections, is a common requirement in programming. Sometimes, a program uses a given resource and doesn’t release the associated memory when it no longer needs the resource. This kind of issue is called a &lt;a href=&quot;https://en.wikipedia.org/wiki/Memory_leak&quot;&gt;memory leak&lt;/a&gt; because the available memory shrinks every time you create a new instance of a resource without releasing the unneeded ones.&lt;/p&gt;
&lt;p&gt;Managing resources properly is often a tricky task. It requires &lt;strong&gt;setup&lt;/strong&gt; and &lt;strong&gt;teardown&lt;/strong&gt; phases. The latter phase requires you to perform cleanup actions, like &lt;a href=&quot;https://realpython.com/why-close-file-python/&quot;&gt;closing a file&lt;/a&gt;, releasing a lock, or closing a network connection. If you forget to perform these cleanup actions, then your application keeps the resource occupied. This behavior might compromise valuable system resources, such as memory and network bandwidth.&lt;/p&gt;
&lt;p&gt;For example, say that a program that uses databases keeps creating new connections without releasing the old ones or reusing them. In that case, the database &lt;a href=&quot;https://en.wikipedia.org/wiki/Back-end_database&quot;&gt;back end&lt;/a&gt; can stop accepting new connections. This might require an administrator to log in and manually terminate those stale connections to make the database usable again.&lt;/p&gt;
&lt;p&gt;Another common issue occurs when developers work with files. &lt;a href=&quot;https://realpython.com/read-write-files-python/&quot;&gt;Writing text to files&lt;/a&gt; is usually a &lt;a href=&quot;https://realpython.com/python-flush-print-output/#understand-how-python-buffers-output&quot;&gt;buffered&lt;/a&gt; operation. This means that calling &lt;code&gt;.write()&lt;/code&gt; on a file won’t immediately result in writing text to the physical file, but to a temporary buffer. Sometimes, when the buffer isn’t full, developers forget to call &lt;code&gt;.close()&lt;/code&gt; and part of the data can be lost.&lt;/p&gt;
&lt;p&gt;Another possibility is that your application runs into errors or &lt;a href=&quot;https://realpython.com/python-exceptions/&quot;&gt;exceptions&lt;/a&gt; that cause the &lt;a href=&quot;https://realpython.com/python-control-flow/&quot;&gt;control flow&lt;/a&gt; to bypass the code responsible for releasing the resource at hand. Here’s an example where you use the built-in &lt;a href=&quot;https://realpython.com/python-built-in-functions/#opening-files-open&quot;&gt;&lt;code&gt;open()&lt;/code&gt;&lt;/a&gt; function to write some text to a file:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;This code doesn’t guarantee the file will be closed if an exception occurs during the call to &lt;code&gt;.write()&lt;/code&gt;. In this situation, the code might never call &lt;code&gt;.close()&lt;/code&gt;, and your program will leak a file descriptor. Failing to release a file descriptor on some operating systems can prevent other programs from accessing the underlying file.&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; To learn more about closing files, check out the &lt;a href=&quot;https://realpython.com/why-close-file-python/&quot;&gt;Why Is It Important to Close Files in Python?&lt;/a&gt; tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In Python, you can use a couple of general approaches to deal with resource management. You can wrap your code in:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;a href=&quot;https://realpython.com/python-exceptions/#cleaning-up-after-using-finally&quot;&gt;&lt;code&gt;try&lt;/code&gt; … &lt;code&gt;finally&lt;/code&gt;&lt;/a&gt; construct&lt;/li&gt;
&lt;li&gt;A &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html#the-with-statement&quot;&gt;&lt;code&gt;with&lt;/code&gt;&lt;/a&gt; construct&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first approach is quite generic and allows you to provide setup and teardown code to manage any kind of resource. However, it’s a little bit verbose, and you might forget some cleanup actions if you use this construct in several places.&lt;/p&gt;
&lt;p&gt;The second approach provides a straightforward way to provide and reuse setup and teardown code. In this case, you’ll have the limitation that the &lt;code&gt;with&lt;/code&gt; statement only works with &lt;a href=&quot;/ref/glossary/context-manager/&quot; class=&quot;ref-link&quot;&gt;context managers&lt;/a&gt;. In the next two sections, you’ll learn how to use both approaches in your code.&lt;/p&gt;
&lt;h3 id=&quot;the-try-finally-construct&quot;&gt;The &lt;code&gt;try&lt;/code&gt; … &lt;code&gt;finally&lt;/code&gt; Construct&lt;a class=&quot;headerlink&quot; href=&quot;#the-try-finally-construct&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Working with files is probably the most common example of resource management in programming. In Python, you can use a &lt;strong&gt;&lt;code&gt;try&lt;/code&gt; … &lt;code&gt;finally&lt;/code&gt;&lt;/strong&gt; construct to handle opening and closing files properly:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.770597e4ea96.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;In this example, you open the &lt;code&gt;hello.txt&lt;/code&gt; file using &lt;code&gt;open()&lt;/code&gt;. To write some text into the file, you wrap the call to &lt;code&gt;.write()&lt;/code&gt; in a &lt;a href=&quot;/ref/keywords/try/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;try&lt;/code&gt;&lt;/a&gt; statement with a &lt;a href=&quot;/ref/keywords/finally/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;finally&lt;/code&gt;&lt;/a&gt; clause. This clause guarantees that the file is properly closed by calling &lt;code&gt;.close()&lt;/code&gt;, even if an exception occurs during the call to &lt;code&gt;.write()&lt;/code&gt; in the &lt;code&gt;try&lt;/code&gt; clause. Remember that the &lt;code&gt;finally&lt;/code&gt; clause always runs.&lt;/p&gt;
&lt;p&gt;When managing external resources in Python, you can use the construct in the previous example to handle setup and teardown logic. The setup logic might include opening the file and writing content to it, while the teardown logic might consist of closing the file to release the acquired resources.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-with-statement/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-with-statement/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Working With Python&#x27;s .__dict__ Attribute</title>
      <id>https://realpython.com/courses/working-dict-attributes/</id>
      <link href="https://realpython.com/courses/working-dict-attributes/"/>
      <updated>2025-08-12T14:00:00+00:00</updated>
      <summary>Explore Python&#x27;s .__dict__ attribute to manage class and instance attributes directly for more flexible, low-level control of your objects.</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s &lt;code&gt;.__dict__&lt;/code&gt; is a special attribute in classes and instances that acts as a namespace, mapping attribute names to their corresponding values. You can use &lt;code&gt;.__dict__&lt;/code&gt; to inspect, modify, add, or delete attributes dynamically, which makes it a versatile tool for metaprogramming and debugging.&lt;/p&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll learn about using &lt;code&gt;.__dict__&lt;/code&gt; in various contexts, including classes, instances, and functions. You&amp;rsquo;ll also explore its role in inheritance with practical examples and comparisons to other tools for manipulating attributes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;.__dict__&lt;/code&gt;&lt;/strong&gt; holds an object&amp;rsquo;s &lt;strong&gt;writable attributes&lt;/strong&gt;, allowing for dynamic manipulation and introspection.&lt;/li&gt;
&lt;li&gt;Both &lt;strong&gt;&lt;code&gt;vars()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;.__dict__&lt;/code&gt;&lt;/strong&gt; let you &lt;strong&gt;inspect&lt;/strong&gt; an object&amp;rsquo;s attributes. The &lt;code&gt;.__dict__&lt;/code&gt; attribute gives you direct access to the object&amp;rsquo;s namespace, while the &lt;code&gt;vars()&lt;/code&gt; function returns the object&amp;rsquo;s &lt;code&gt;.__dict__&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Common use cases of &lt;code&gt;.__dict__&lt;/code&gt; include &lt;strong&gt;dynamic attribute management&lt;/strong&gt;, &lt;strong&gt;introspection&lt;/strong&gt;, &lt;strong&gt;serialization&lt;/strong&gt;, and &lt;strong&gt;debugging&lt;/strong&gt; in Python applications.&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 #260: Harnessing the Power of Python Polars</title>
      <id>https://realpython.com/podcasts/rpp/260/</id>
      <link href="https://realpython.com/podcasts/rpp/260/"/>
      <updated>2025-08-08T12:00:00+00:00</updated>
      <summary>What are the advantages of using Polars for your Python data projects? When should you use the lazy or eager APIs, and what are the benefits of each? This week on the show, we speak with Jeroen Janssens and Thijs Nieuwdorp about their new book, _Python Polars: The Definitive Guide_.</summary>
      <content type="html">
        &lt;p&gt;What are the advantages of using Polars for your Python data projects? When should you use the lazy or eager APIs, and what are the benefits of each? This week on the show, we speak with Jeroen Janssens and Thijs Nieuwdorp about their new book, _Python Polars: The Definitive Guide_.&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>Exploring Python T-Strings</title>
      <id>https://realpython.com/courses/exploring-t-strings/</id>
      <link href="https://realpython.com/courses/exploring-t-strings/"/>
      <updated>2025-08-05T14:00:00+00:00</updated>
      <summary>Python 3.14 introduces t-strings: a safer, more flexible alternative to f-strings. Learn how to process templates securely and customize string workflows.</summary>
      <content type="html">
        &lt;p&gt;Python 3.14&amp;rsquo;s t-strings allow you to intercept and transform input values before assembling them into a final representation. Unlike f-strings, which produce a &lt;code&gt;str&lt;/code&gt; object, t-strings resolve to a &lt;code&gt;Template&lt;/code&gt; instance, allowing you to safely process and customize dynamic content.&lt;/p&gt;
&lt;p&gt;One of the key benefits of t-strings is their ability to help prevent security vulnerabilities like SQL injection and XSS attacks. They&amp;rsquo;re also valuable in other fields that rely on string templates, such as structured logging.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python &lt;strong&gt;t-strings&lt;/strong&gt; are a generalization of f-strings, designed to safely handle and process &lt;strong&gt;input values&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;main components&lt;/strong&gt; of a t-string include &lt;strong&gt;static string&lt;/strong&gt; parts and &lt;strong&gt;interpolations&lt;/strong&gt;, which are accessible through the &lt;strong&gt;&lt;code&gt;Template&lt;/code&gt;&lt;/strong&gt; class.&lt;/li&gt;
&lt;li&gt;You process t-strings by iterating over their components, using attributes such as &lt;strong&gt;&lt;code&gt;.strings&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;.interpolations&lt;/code&gt;&lt;/strong&gt;, and &lt;strong&gt;&lt;code&gt;.values&lt;/code&gt;&lt;/strong&gt; for safe and customized handling.&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 #259: Design Patterns That Don&#x27;t Translate to Python</title>
      <id>https://realpython.com/podcasts/rpp/259/</id>
      <link href="https://realpython.com/podcasts/rpp/259/"/>
      <updated>2025-08-01T12:00:00+00:00</updated>
      <summary>Do the design patterns learned in other programming languages translate to coding in Python? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Do the design patterns learned in other programming languages translate to coding in Python? Christopher Trudeau is back on the show this week, bringing 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>Working With Python&#x27;s Built-in Exceptions</title>
      <id>https://realpython.com/courses/working-builtin-exceptions/</id>
      <link href="https://realpython.com/courses/working-builtin-exceptions/"/>
      <updated>2025-07-29T14:00:00+00:00</updated>
      <summary>Learn the most common built-in Python exceptions, when they occur, how to handle them, and how to raise them properly in your code.</summary>
      <content type="html">
        &lt;p&gt;Python has a complete set of &lt;strong&gt;built-in exceptions&lt;/strong&gt; that provide a quick and efficient way to handle errors and exceptional situations in your code. Knowing the most commonly used built-in exceptions is key for you as a Python developer. This knowledge will help you debug code because each exception has a specific meaning that can shed light on your debugging process.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll also be able to handle and raise most of the built-in exceptions in your Python code, which is a great way to deal with errors and exceptional situations without having to create your own custom exceptions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn what &lt;strong&gt;errors&lt;/strong&gt; and &lt;strong&gt;exceptions&lt;/strong&gt; are in Python&lt;/li&gt;
&lt;li&gt;Understand how Python organizes the &lt;strong&gt;built-in exceptions&lt;/strong&gt; within a &lt;strong&gt;class hierarchy&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Explore the most &lt;strong&gt;commonly used&lt;/strong&gt; built-in exceptions&lt;/li&gt;
&lt;li&gt;Learn how to &lt;strong&gt;handle&lt;/strong&gt; and &lt;strong&gt;raise&lt;/strong&gt; built-in exceptions in your code&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 #258: Supporting the Python Package Index</title>
      <id>https://realpython.com/podcasts/rpp/258/</id>
      <link href="https://realpython.com/podcasts/rpp/258/"/>
      <updated>2025-07-25T12:00:00+00:00</updated>
      <summary>What goes into supporting more than 650,000 projects and nearly a million users of the Python Package Index? This week on the show, we speak with Maria Ashna about her first year as the inaugural PyPI Support Specialist.</summary>
      <content type="html">
        &lt;p&gt;What goes into supporting more than 650,000 projects and nearly a million users of the Python Package Index? This week on the show, we speak with Maria Ashna about her first year as the inaugural PyPI Support Specialist.&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>Exploring Python Closures: Examples and Use Cases</title>
      <id>https://realpython.com/courses/closures-examples-use-cases/</id>
      <link href="https://realpython.com/courses/closures-examples-use-cases/"/>
      <updated>2025-07-22T14:00:00+00:00</updated>
      <summary>Learn about Python closures: function-like objects with extended scope used for decorators, factories, and stateful functions.</summary>
      <content type="html">
        &lt;p&gt;In Python, a closure is typically a function defined inside another function. This inner function grabs the objects defined in its enclosing scope and associates them with the inner function object itself. The resulting combination is called a closure.&lt;/p&gt;
&lt;p&gt;Closures are a common feature in functional programming languages. In Python, closures can be pretty useful because they allow you to create function-based decorators, which are powerful tools.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn what &lt;strong&gt;closures&lt;/strong&gt; are and how they work in Python&lt;/li&gt;
&lt;li&gt;Get to know common &lt;strong&gt;use cases&lt;/strong&gt; of closures&lt;/li&gt;
&lt;li&gt;Explore &lt;strong&gt;alternatives&lt;/strong&gt; to closures&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>Getting Started With marimo Notebooks</title>
      <id>https://realpython.com/courses/getting-started-with-marimo-notebooks/</id>
      <link href="https://realpython.com/courses/getting-started-with-marimo-notebooks/"/>
      <updated>2025-07-15T14:00:00+00:00</updated>
      <summary>Discover how marimo notebook simplifies coding with reactive updates, UI elements, and sandboxing for safe, sharable notebooks.</summary>
      <content type="html">
        &lt;p&gt;&lt;a href=&quot;https://marimo.io&quot;&gt;marimo notebooks&lt;/a&gt; redefine the notebook experience by offering a reactive environment that addresses the limitations of traditional linear notebooks. With marimo, you can seamlessly reproduce and share content while benefiting from automatic cell updates and a correct execution order. Discover how marimo&amp;rsquo;s features make it an ideal tool for documenting research and learning activities.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;marimo notebooks&lt;/strong&gt; automatically update dependent cells, ensuring consistent results across your work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reactivity&lt;/strong&gt; allows marimo to determine the correct running order of cells using a &lt;strong&gt;directed acyclic graph (DAG)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sandboxing&lt;/strong&gt; in marimo creates isolated environments for notebooks, preventing package conflicts and ensuring reproducibility.&lt;/li&gt;
&lt;li&gt;You can add &lt;strong&gt;interactivity&lt;/strong&gt; to marimo notebooks with &lt;strong&gt;UI elements&lt;/strong&gt; like sliders and radio buttons.&lt;/li&gt;
&lt;li&gt;Traditional &lt;strong&gt;linear notebooks&lt;/strong&gt; have inherent flaws, such as hidden state issues, that marimo addresses with its reactive design.&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 #257: Comparing Real-World Python Performance Against Big O</title>
      <id>https://realpython.com/podcasts/rpp/257/</id>
      <link href="https://realpython.com/podcasts/rpp/257/"/>
      <updated>2025-07-11T12:00:00+00:00</updated>
      <summary>How does the performance of an algorithm hold up when you put it into a realistic context? Where might Python code defy Big O notation expectations when using a profiler? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;How does the performance of an algorithm hold up when you put it into a realistic context? Where might Python code defy Big O notation expectations when using a profiler? Christopher Trudeau is back on the show this week, bringing 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>The Real Python Podcast – Episode #256: Solving Problems and Saving Time in Chemistry With Python</title>
      <id>https://realpython.com/podcasts/rpp/256/</id>
      <link href="https://realpython.com/podcasts/rpp/256/"/>
      <updated>2025-07-04T12:00:00+00:00</updated>
      <summary>What motivates someone to learn how to code as a scientist? How do you harness the excitement of solving problems quickly and make the connection to the benefits of coding in your scientific work? This week on the show, we speak with Ben Lear and Christopher Johnson about their book &quot;Coding For Chemists.&quot;</summary>
      <content type="html">
        &lt;p&gt;What motivates someone to learn how to code as a scientist? How do you harness the excitement of solving problems quickly and make the connection to the benefits of coding in your scientific work? This week on the show, we speak with Ben Lear and Christopher Johnson about their book &quot;Coding For Chemists.&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>
  

</feed>
