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

  
    <entry>
      <title>Python&#x27;s Bytearray: A Mutable Sequence of Bytes</title>
      <id>https://realpython.com/python-bytearray/</id>
      <link href="https://realpython.com/python-bytearray/"/>
      <updated>2025-03-31T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about Python&#x27;s bytearray, a mutable sequence of bytes for efficient binary data manipulation. You&#x27;ll explore how it differs from bytes, how to create and modify bytearray objects, and when to use them in tasks like processing binary files and network protocols.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;code&gt;bytearray&lt;/code&gt; is a mutable sequence of bytes that allows you to manipulate binary data efficiently. Unlike immutable &lt;code&gt;bytes&lt;/code&gt;, &lt;code&gt;bytearray&lt;/code&gt; can be modified in place, making it suitable for tasks requiring frequent updates to byte sequences.&lt;/p&gt;
&lt;p&gt;You can create a &lt;code&gt;bytearray&lt;/code&gt; using the &lt;code&gt;bytearray()&lt;/code&gt; constructor with various arguments or from a string of hexadecimal digits using &lt;code&gt;.fromhex()&lt;/code&gt;. This tutorial explores creating, modifying, and using &lt;code&gt;bytearray&lt;/code&gt; objects in Python.&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;A &lt;code&gt;bytearray&lt;/code&gt; in Python&lt;/strong&gt; is a mutable sequence of bytes that allows in-place modifications, unlike the immutable &lt;code&gt;bytes&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;You create a &lt;code&gt;bytearray&lt;/code&gt;&lt;/strong&gt; by using the &lt;code&gt;bytearray()&lt;/code&gt; constructor with a non-negative integer, iterable of integers, bytes-like object, or a string with specified encoding.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;You can modify a &lt;code&gt;bytearray&lt;/code&gt;&lt;/strong&gt; in Python by appending, slicing, or changing individual bytes, thanks to its mutable nature.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Common uses for &lt;code&gt;bytearray&lt;/code&gt;&lt;/strong&gt; include processing large binary files, working with network protocols, and tasks needing frequent updates to byte sequences.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll dive deeper into each aspect of &lt;code&gt;bytearray&lt;/code&gt;, exploring its creation, manipulation, and practical applications in Python programming.&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-bytearray-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-bytearray-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 about Python’s bytearray data type.&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.6eec2e95bede.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&#x27;s Bytearray” 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-bytearray/&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;Python&#x27;s Bytearray: A Mutable Sequence of Bytes&quot; src=&quot;https://files.realpython.com/media/Pythons-Bytearray_Watermarked.736fb67a3a9a.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Pythons-Bytearray_Watermarked.736fb67a3a9a.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Pythons-Bytearray_Watermarked.736fb67a3a9a.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Pythons-Bytearray_Watermarked.736fb67a3a9a.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Pythons-Bytearray_Watermarked.736fb67a3a9a.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.6eec2e95bede.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-bytearray/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python&#x27;s Bytearray&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 Python&#x27;s bytearray data type. By working through this quiz, you&#x27;ll revisit the key concepts and uses of bytearray in Python.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;understanding-pythons-bytearray-type&quot;&gt;Understanding Python’s &lt;code&gt;bytearray&lt;/code&gt; Type&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-pythons-bytearray-type&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Although Python remains a high-level programming language, it exposes a few specialized data types that let you manipulate binary data directly should you ever need to. These data types can be useful for tasks such as processing custom binary file formats, or working with low-level network protocols requiring precise control over the data.&lt;/p&gt;
&lt;p&gt;The three closely related &lt;a href=&quot;https://docs.python.org/3/library/stdtypes.html#binaryseq&quot;&gt;binary sequence types&lt;/a&gt; built into the language are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;bytes&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bytearray&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;memoryview&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While they’re all &lt;a href=&quot;https://realpython.com/python-sequences/&quot;&gt;Python sequences&lt;/a&gt; optimized for performance when dealing with binary data, they each have slightly different strengths and use cases.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You’ll take a deep dive into Python’s &lt;code&gt;bytearray&lt;/code&gt; in this tutorial. But, if you’d like to learn more about the companion &lt;code&gt;bytes&lt;/code&gt; data type, then check out &lt;a href=&quot;https://realpython.com/python-bytes/&quot;&gt;Bytes Objects: Handling Binary Data in Python&lt;/a&gt;, which also covers binary data fundamentals.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;As both names suggest, &lt;a href=&quot;/ref/builtin-types/bytes/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;bytes&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;/ref/builtin-types/bytearray/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;bytearray&lt;/code&gt;&lt;/a&gt; are sequences of individual &lt;em&gt;byte&lt;/em&gt; values, letting you process binary data at the &lt;strong&gt;byte level&lt;/strong&gt;. For example, you may use them to work with plain text data, which typically represents characters as unique byte values, depending on the given &lt;a href=&quot;https://realpython.com/python-encodings-guide/&quot;&gt;character encoding&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Python natively interprets bytes as 8-bit &lt;a href=&quot;https://realpython.com/python-bitwise-operators/#unsigned-integers&quot;&gt;unsigned integers&lt;/a&gt;, each representing one of 256 possible values (2&lt;sup&gt;8&lt;/sup&gt;) between 0 and 255. But sometimes, you may need to interpret the same bit pattern as a &lt;a href=&quot;https://realpython.com/python-bitwise-operators/#signed-integers&quot;&gt;signed integer&lt;/a&gt;, for example, when handling digital audio samples that encode a sound wave’s amplitude levels. See the &lt;a href=&quot;https://realpython.com/python-bytes/#signedness-and-the-sign-bit&quot;&gt;section on signedness&lt;/a&gt; in the Python &lt;code&gt;bytes&lt;/code&gt; tutorial for more details.&lt;/p&gt;
&lt;p&gt;The choice between &lt;code&gt;bytes&lt;/code&gt; and &lt;code&gt;bytearray&lt;/code&gt; boils down to whether you want read-only access to the underlying bytes or not. Instances of the &lt;code&gt;bytes&lt;/code&gt; data type are &lt;a href=&quot;https://realpython.com/python-mutable-vs-immutable-types/&quot;&gt;immutable&lt;/a&gt;, meaning each one has a fixed value that you can’t change once the object is created. In contrast, &lt;code&gt;bytearray&lt;/code&gt; objects are &lt;strong&gt;mutable sequences&lt;/strong&gt;, allowing you to modify their contents after creation.&lt;/p&gt;
&lt;p&gt;While it may seem counterintuitive at first—since many newcomers to Python expect objects to be directly modifiable—immutable objects have several benefits over their mutable counterparts. That’s why types like strings, tuples, and others require reassignment in Python.&lt;/p&gt;
&lt;p&gt;The advantages of immutable data types include better memory efficiency due to the ability to &lt;a href=&quot;https://realpython.com/lru-cache-python/&quot;&gt;cache&lt;/a&gt; or reuse objects without unnecessary copying. In Python, immutable objects are inherently &lt;a href=&quot;/ref/glossary/hashable/&quot; class=&quot;ref-link&quot;&gt;hashable&lt;/a&gt;, so they can become &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt; keys or &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;set&lt;/a&gt; elements. Additionally, relying on immutable objects gives you extra security, data integrity, and &lt;a href=&quot;https://realpython.com/python-thread-lock/&quot;&gt;thread safety&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That said, if you need a binary sequence that allows for modification, then &lt;code&gt;bytearray&lt;/code&gt; is the way to go. Use it when you frequently perform &lt;a href=&quot;https://en.wikipedia.org/wiki/In-place_algorithm&quot;&gt;in-place&lt;/a&gt; byte operations that involve changing the contents of the sequence, such as appending, inserting, extending, or modifying individual bytes. A scenario where &lt;code&gt;bytearray&lt;/code&gt; can be particularly useful includes processing large binary files in chunks or incrementally reading messages from a network buffer.&lt;/p&gt;
&lt;p&gt;The third binary sequence type in Python mentioned earlier, &lt;a href=&quot;/ref/builtin-functions/memoryview/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;memoryview&lt;/code&gt;&lt;/a&gt;, provides a zero-overhead view into the memory of certain objects. Unlike &lt;code&gt;bytes&lt;/code&gt; and &lt;code&gt;bytearray&lt;/code&gt;, whose mutability status is fixed, a &lt;code&gt;memoryview&lt;/code&gt; can be either mutable or immutable depending on the target object it references. Just like &lt;code&gt;bytes&lt;/code&gt; and &lt;code&gt;bytearray&lt;/code&gt;, a &lt;code&gt;memoryview&lt;/code&gt; may represent a series of single bytes, but at the same time, it can represent a sequence of &lt;a href=&quot;https://en.wikipedia.org/wiki/Word_(computer_architecture)&quot;&gt;multi-byte words&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now that you have a basic understanding of Python’s binary sequence types and where &lt;code&gt;bytearray&lt;/code&gt; fits into them, you can explore ways to create and work with &lt;code&gt;bytearray&lt;/code&gt; objects in Python.&lt;/p&gt;
&lt;h2 id=&quot;creating-bytearray-objects-in-python&quot;&gt;Creating &lt;code&gt;bytearray&lt;/code&gt; Objects in Python&lt;a class=&quot;headerlink&quot; href=&quot;#creating-bytearray-objects-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Unlike the immutable &lt;code&gt;bytes&lt;/code&gt; data type, whose &lt;a href=&quot;https://realpython.com/python-bytes/#the-bytes-literal-format&quot;&gt;literal form&lt;/a&gt; resembles a string literal prefixed with the letter &lt;code&gt;b&lt;/code&gt;—for example, &lt;code&gt;b&quot;GIF89a&quot;&lt;/code&gt;—the mutable &lt;code&gt;bytearray&lt;/code&gt; has &lt;strong&gt;no literal syntax&lt;/strong&gt; in Python. This distinction is important despite many similarities between both byte-oriented sequences, which you’ll discover in the next section.&lt;/p&gt;
&lt;p&gt;The primary way to create new &lt;code&gt;bytearray&lt;/code&gt; instances is by explicitly calling the type’s &lt;a href=&quot;https://realpython.com/python-class-constructor/&quot;&gt;class constructor&lt;/a&gt;, sometimes informally known as the &lt;code&gt;bytearray()&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-built-in-functions/&quot;&gt;built-in function&lt;/a&gt;. Alternatively, you can create a &lt;code&gt;bytearray&lt;/code&gt; from a string of hexadecimal digits. You’ll learn about both methods next.&lt;/p&gt;
&lt;h3 id=&quot;the-bytearray-constructor&quot;&gt;The &lt;code&gt;bytearray()&lt;/code&gt; Constructor&lt;a class=&quot;headerlink&quot; href=&quot;#the-bytearray-constructor&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-bytearray/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-bytearray/ »&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: Using Python&#x27;s .__dict__ to Work With Attributes</title>
      <id>https://realpython.com/quizzes/python-dict-attribute/</id>
      <link href="https://realpython.com/quizzes/python-dict-attribute/"/>
      <updated>2025-03-27T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s .__dict__ attribute and its usage in classes, instances, and functions. Acting as a namespace, this attribute maps attribute names to their corresponding values and serves as a versatile tool for metaprogramming and debugging.</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/python-dict-attribute/&quot;&gt;Using Python&amp;rsquo;s &lt;code&gt;.__dict__&lt;/code&gt; to Work With Attributes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how &lt;code&gt;.__dict__&lt;/code&gt; holds an object&amp;rsquo;s writable attributes, allowing for dynamic manipulation and introspection. You&amp;rsquo;ll also review how both &lt;code&gt;vars()&lt;/code&gt; and &lt;code&gt;.__dict__&lt;/code&gt; let you inspect an object&amp;rsquo;s attributes, and the common use cases of &lt;code&gt;.__dict__&lt;/code&gt; in Python applications.&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>Introducing DuckDB</title>
      <id>https://realpython.com/python-duckdb/</id>
      <link href="https://realpython.com/python-duckdb/"/>
      <updated>2025-03-26T14:00:00+00:00</updated>
      <summary>In this showcase tutorial, you&#x27;ll be introduced to a library that allows you to use a database in your code. DuckDB provides an efficient relational database that supports many features you may already be familiar with from more traditional relational database systems.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The DuckDB database provides a seamless way to handle large datasets in Python with Online Analytical Processing (OLAP) optimization. You can create databases, verify data imports, and perform efficient data queries using both SQL and DuckDB’s Python API.&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 &lt;strong&gt;create a DuckDB database&lt;/strong&gt; by reading data from files like Parquet, CSV, or JSON and saving it to a table.&lt;/li&gt;
&lt;li&gt;You &lt;strong&gt;query a DuckDB database&lt;/strong&gt; using standard SQL syntax within Python by executing queries through a DuckDB connection object.&lt;/li&gt;
&lt;li&gt;You can also use &lt;strong&gt;DuckDB’s Python API&lt;/strong&gt;, which uses method chaining for an object-oriented approach to database queries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concurrent access in DuckDB&lt;/strong&gt; allows multiple reads but restricts concurrent writes to ensure data integrity.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DuckDB integrates with pandas and Polars&lt;/strong&gt; by converting query results into DataFrames using the &lt;code&gt;.df()&lt;/code&gt; or &lt;code&gt;.pl()&lt;/code&gt; methods.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The tutorial will equip you with the practical knowledge necessary to get started with DuckDB, including its &lt;a href=&quot;https://en.wikipedia.org/wiki/Online_analytical_processing&quot;&gt;Online Analytical Processing (OLAP)&lt;/a&gt; features, which enable fast access to data through query optimization and buffering.&lt;/p&gt;
&lt;p&gt;Ideally, you should already have a basic understanding of &lt;a href=&quot;https://www.sqltutorial.org/sql-syntax/&quot;&gt;SQL&lt;/a&gt;, particularly how its &lt;code&gt;SELECT&lt;/code&gt; keyword can be used to read data from a relational database. However, the SQL language is very user-friendly, and the examples used here are self-explanatory.&lt;/p&gt;
&lt;p&gt;Now, it’s time for you to start learning why there’s a growing buzz surrounding &lt;a href=&quot;https://duckdb.org/&quot;&gt;DuckDB&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;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-duckdb-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-duckdb-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 DuckDB 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.6eec2e95bede.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 “Introducing DuckDB” 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/introducing-duckdb/&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;Introducing DuckDB&quot; src=&quot;https://files.realpython.com/media/Showcase-DuckDB_Watermarked.4ff6c6a498a1.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Showcase-DuckDB_Watermarked.4ff6c6a498a1.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Showcase-DuckDB_Watermarked.4ff6c6a498a1.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Showcase-DuckDB_Watermarked.4ff6c6a498a1.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Showcase-DuckDB_Watermarked.4ff6c6a498a1.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.6eec2e95bede.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/introducing-duckdb/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Introducing DuckDB&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;This quiz will challenge your knowledge of working with DuckDB. You won&#x27;t find all the answers in the tutorial, so you&#x27;ll need to do some extra investigation. By finding all the answers, you&#x27;re sure to learn some interesting things along the way.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-duckdb&quot;&gt;Getting Started With DuckDB&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-duckdb&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To use DuckDB, you first need to install it. Fortunately, DuckDB is self-contained, meaning it won’t interfere with your existing Python environment.&lt;/p&gt;
&lt;p&gt;You use &lt;code&gt;python -m pip install duckdb&lt;/code&gt; to install it from the command prompt. If you’re working in a Jupyter Notebook, the command becomes &lt;code&gt;!python -m pip install duckdb&lt;/code&gt;. The supporting downloadable code for this tutorial is also presented in a Jupyter Notebook.&lt;/p&gt;
&lt;p&gt;Once the installation is complete, you can quickly test your installation with a query:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;duckdb&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;duckdb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;SELECT &#x27;whistling_duck&#x27; AS waterfowl, &#x27;whistle&#x27; AS call&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;┌────────────────┬─────────┐&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│   waterfowl    │  call   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│    varchar     │ varchar │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;├────────────────┼─────────┤&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ whistling_duck │ whistle │&lt;/span&gt;
&lt;span class=&quot;go&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To test that everything works, you first import the &lt;code&gt;duckdb&lt;/code&gt; library before running a test SQL &lt;strong&gt;query&lt;/strong&gt;. In SQL, a query is a command you use to interact with the data in your database. You commonly use queries to view, add, update, and delete your data.   &lt;/p&gt;
&lt;p&gt;In this example, you write a SQL &lt;code&gt;SELECT&lt;/code&gt; statement to view some data defined by the query. By passing it to the &lt;code&gt;sql()&lt;/code&gt; function, you run the query and produce the result shown.&lt;/p&gt;
&lt;p&gt;Your query creates a table with two columns named &lt;code&gt;waterfowl&lt;/code&gt; and &lt;code&gt;call&lt;/code&gt;. These contain the data &lt;code&gt;&quot;whistling_duck&quot;&lt;/code&gt; and &lt;code&gt;&quot;whistle&quot;&lt;/code&gt;, respectively. The data types of both columns are &lt;code&gt;varchar&lt;/code&gt;, which is the data type DuckDB uses to store variable-length character strings. Running your query using &lt;code&gt;duckdb.sql()&lt;/code&gt; uses the default in-memory database. This means that the data are temporary and will disappear when you end your Python session.&lt;/p&gt;
&lt;p&gt;If you see the output shown above, your installation is working perfectly.&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; DuckDB queries are not case-sensitive. However, writing reserved SQL keywords in uppercase is standard practice. Also, a terminating semicolon (;) is optional in SQL and isn’t used in this tutorial, though you may encounter it elsewhere.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now that you know how to set things up, it’s time to dive into some of the features that make DuckDB easy to use. In the next section, you’ll create a database table using data imported from an existing file. You’ll also learn how to check that the data has been imported correctly.&lt;/p&gt;
&lt;h3 id=&quot;creating-a-database-from-a-data-source&quot;&gt;Creating a Database From a Data Source&lt;a class=&quot;headerlink&quot; href=&quot;#creating-a-database-from-a-data-source&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;While it’s possible to create database tables using SQL, it’s more common to read data from an external file, perhaps one containing data you’ve extracted from another system, and allow DuckDB to create and populate the table.&lt;/p&gt;
&lt;p&gt;DuckDB supports reading from and writing to a range of common file types such as Parquet, CSV, and JSON. In this example, you’ll use data stored in the &lt;code&gt;presidents.parquet&lt;/code&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Apache_Parquet&quot;&gt;Parquet&lt;/a&gt; file included in your downloadable materials to create a table.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;presidents.parquet&lt;/code&gt; file contains the following six fields:&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;Heading&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Data Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sequence&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Order of presidency&lt;/td&gt;
&lt;td&gt;&lt;code&gt;int64&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;last_name&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;President’s last name&lt;/td&gt;
&lt;td&gt;&lt;code&gt;varchar&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;first_name&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;President’s first name&lt;/td&gt;
&lt;td&gt;&lt;code&gt;varchar&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;term_start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start of presidency term&lt;/td&gt;
&lt;td&gt;&lt;code&gt;date&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;term_end&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;End of presidency term&lt;/td&gt;
&lt;td&gt;&lt;code&gt;date&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;party_id&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Number representing political party&lt;/td&gt;
&lt;td&gt;&lt;code&gt;int64&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;When you import data, it gets placed into a &lt;code&gt;DuckDBPyRelation&lt;/code&gt; object. In DuckDB, a &lt;strong&gt;relation&lt;/strong&gt; stores a query definition but not its data. To see the data your relation represents, you must do so interactively by viewing it or running an SQL query against it to see specific data.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-duckdb/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-duckdb/ »&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>What Can You Do With Python?</title>
      <id>https://realpython.com/courses/what-can-you-do-with-python/</id>
      <link href="https://realpython.com/courses/what-can-you-do-with-python/"/>
      <updated>2025-03-25T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll find a set of guidelines that will help you start applying your Python skills to solve real-world problems. By the end, you&#x27;ll be able to answer the question, &quot;What can you do with Python?&quot;</summary>
      <content type="html">
        &lt;p&gt;You&amp;rsquo;ve finished a course or finally made it to the end of a &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;book&lt;/a&gt; that teaches you the &lt;a href=&quot;https://realpython.com/learning-paths/python3-introduction/&quot;&gt;basics of programming with Python&lt;/a&gt;. You&amp;rsquo;ve learned about &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists, tuples&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;&lt;code&gt;while&lt;/code&gt;&lt;/a&gt; loops, &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented concepts&lt;/a&gt;, and more. So, what&amp;rsquo;s next? What can you do with Python nowadays?&lt;/p&gt;
&lt;p&gt;Python is a versatile programming language with many use cases in a variety of different fields. If you&amp;rsquo;ve grasped the basics of Python and are itching to build something with the language, then it&amp;rsquo;s time to figure out what your next step should be.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll see how you can use Python for:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Doing general &lt;strong&gt;software development&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Diving into &lt;strong&gt;data science and math&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Speeding up and automating your &lt;strong&gt;workflow&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Building &lt;strong&gt;embedded systems&lt;/strong&gt; and &lt;strong&gt;robots&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Python&#x27;s Instance, Class, and Static Methods Demystified</title>
      <id>https://realpython.com/quizzes/instance-class-and-static-methods-demystified/</id>
      <link href="https://realpython.com/quizzes/instance-class-and-static-methods-demystified/"/>
      <updated>2025-03-25T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of instance, class, and static methods in Python. By working through this quiz, you&#x27;ll revisit the differences between these methods and how to use them effectively in your Python code.</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/instance-class-and-static-methods-demystified/&quot;&gt;Instance, Class, and Static Methods in Python&lt;/a&gt;. By working through this quiz, you&amp;rsquo;ll revisit the differences between these methods and how to use them effectively in your Python code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Python Set Comprehensions: How and When to Use Them</title>
      <id>https://realpython.com/quizzes/python-set-comprehension/</id>
      <link href="https://realpython.com/quizzes/python-set-comprehension/"/>
      <updated>2025-03-25T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python set comprehensions. Set comprehensions are a concise and quick way to create, transform, and filter sets in Python. They can significantly enhance your code&#x27;s conciseness and readability compared to using regular for loops to process your sets.</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/python-set-comprehension/&quot;&gt;Python Set Comprehensions: How and When to Use Them&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Set comprehensions are a concise and quick way to create, transform, and filter sets in Python.
They can significantly enhance your code&amp;rsquo;s conciseness and readability compared to using regular &lt;code&gt;for&lt;/code&gt; loops to process your sets.&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: Dictionaries in Python</title>
      <id>https://realpython.com/quizzes/dictionaries-in-python-update/</id>
      <link href="https://realpython.com/quizzes/dictionaries-in-python-update/"/>
      <updated>2025-03-25T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s dict data type. By working through this quiz, you&#x27;ll revisit how to create and manipulate dictionaries, how to use Python&#x27;s operators and built-in functions with them, and how they&#x27;re implemented for efficient data retrieval.</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/python-dicts/&quot;&gt;Dictionaries in Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to create dictionaries using literals and the &lt;code&gt;dict()&lt;/code&gt; constructor, how to use Python&amp;rsquo;s operators and built-in functions to manipulate them, and how they&amp;rsquo;re implemented as a hash map for fast key lookups.&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: GitHub Actions for Python</title>
      <id>https://realpython.com/quizzes/github-actions-python/</id>
      <link href="https://realpython.com/quizzes/github-actions-python/"/>
      <updated>2025-03-25T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of GitHub Actions for Python. By working through this quiz, you&#x27;ll revisit how to use GitHub Actions and workflows to automate linting, testing, and deployment of a Python project.</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/github-actions-python/&quot;&gt;Continuous Integration and Deployment for Python With GitHub Actions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to use GitHub Actions and workflows to automate linting, testing, and deployment of a Python project. You&amp;rsquo;ll also review how to secure your credentials and automate security and dependency updates.&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 Code Quality: Best Practices and Tools</title>
      <id>https://realpython.com/python-code-quality/</id>
      <link href="https://realpython.com/python-code-quality/"/>
      <updated>2025-03-24T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about code quality and the key factors that make Python code high-quality. You&#x27;ll explore effective strategies, powerful tools, and best practices to elevate your code to the next level.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Producing high-quality Python code involves using appropriate &lt;strong&gt;tools&lt;/strong&gt; and consistently applying &lt;strong&gt;best practices&lt;/strong&gt;. High-quality code is functional, readable, maintainable, efficient, and secure. It adheres to established standards and has excellent documentation.&lt;/p&gt;
&lt;p&gt;You can achieve these qualities by following best practices such as descriptive naming, consistent coding style, modular design, and robust error handling. To help you with all this, you can use tools such as linters, formatters, and profilers.&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;Checking the quality of Python code&lt;/strong&gt; involves using tools like linters and static type checkers to ensure adherence to coding standards and detect potential errors.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Writing quality code in Python&lt;/strong&gt; requires following best practices, such as clear naming conventions, modular design, and comprehensive testing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Good Python code&lt;/strong&gt; is characterized by readability, maintainability, efficiency, and adherence to standards like PEP 8.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Making Python code look good&lt;/strong&gt; involves using formatters to ensure consistent styling and readability, aligning with established coding styles.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Making Python code readable&lt;/strong&gt; means using descriptive names for variables, functions, classes, modules, and packages.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Read on to learn more about the strategies, tools, and best practices that will help you write high-quality Python 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-code-quality-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-code-quality-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 about Python code quality best practices and tools.&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.6eec2e95bede.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 Code Quality: Best Practices and Tools” 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-code-quality/&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: #ffc873;&quot; alt=&quot;Python Code Quality Illustration&quot; src=&quot;https://files.realpython.com/media/code_quality_img.73eae557a204.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/code_quality_img.73eae557a204.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/code_quality_img.73eae557a204.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/code_quality_img.73eae557a204.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/code_quality_img.73eae557a204.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.6eec2e95bede.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-code-quality/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Code Quality: Best Practices and Tools&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 Python code quality, tools, and best practices. By working through this quiz, you&#x27;ll revisit the importance of producing high-quality Python code that&#x27;s functional, readable, maintainable, efficient, and secure.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;defining-code-quality&quot;&gt;Defining Code Quality&lt;a class=&quot;headerlink&quot; href=&quot;#defining-code-quality&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Of course you want quality code. Who wouldn’t? But what is &lt;strong&gt;code quality&lt;/strong&gt;? It turns out that the term can mean different things to different people.&lt;/p&gt;
&lt;p&gt;One way to approach code quality is to look at the two ends of the quality spectrum:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Low-quality code&lt;/strong&gt;: It has the &lt;strong&gt;minimal required&lt;/strong&gt; characteristics to be &lt;strong&gt;functional&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;High-quality code&lt;/strong&gt;: It has &lt;strong&gt;all the necessary&lt;/strong&gt; characteristics that make it work reliably, efficiently, and effectively, while also being straightforward to maintain.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the following sections, you’ll learn about these two quality classifications and their defining characteristics in more detail.&lt;/p&gt;
&lt;h3 id=&quot;low-quality-code&quot;&gt;Low-Quality Code&lt;a class=&quot;headerlink&quot; href=&quot;#low-quality-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Low-quality code typically has only the minimal required characteristics to be functional. It may not be elegant, efficient, or easy to maintain, but at the very least, it meets the following basic criteria:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;It does what it’s supposed to do&lt;/strong&gt;. If the code doesn’t meet its requirements, then it isn’t quality code. You build software to perform a task. If it fails to do so, then it can’t be considered quality code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;It doesn’t contain critical errors&lt;/strong&gt;. If the code has issues and errors or causes you problems, then you probably wouldn’t call it quality code. If it’s too low-quality and becomes unusable, then if falls below even basic quality standards and you may stop using it altogether.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While simplistic, these two characteristics are generally accepted as the baseline of functional but low-quality code. Low-quality code may work, but it often lacks readability, maintainability, and efficiency, making it difficult to scale or improve.&lt;/p&gt;
&lt;h3 id=&quot;high-quality-code&quot;&gt;High-Quality Code&lt;a class=&quot;headerlink&quot; href=&quot;#high-quality-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Now, here’s an extended list of the key characteristics that define high-quality code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Functionality&lt;/strong&gt;: Works as expected and fulfills its intended purpose.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Readability&lt;/strong&gt;: Is easy for humans to understand.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Documentation&lt;/strong&gt;: Clearly explains its purpose and usage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Standards Compliance&lt;/strong&gt;: Adheres to conventions and guidelines, such as PEP 8.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reusability&lt;/strong&gt;: Can be used in different contexts without modification.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Maintainability&lt;/strong&gt;: Allows for modifications and extensions without introducing bugs.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Robustness&lt;/strong&gt;: Handles errors and unexpected inputs effectively.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Testability&lt;/strong&gt;: Can be easily verified for correctness.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;: Optimizes time and resource usage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scalability&lt;/strong&gt;: Handles increased data loads or complexity without degradation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Security&lt;/strong&gt;: Protects against vulnerabilities and malicious inputs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In short, &lt;strong&gt;high-quality code&lt;/strong&gt; is functional, readable, maintainable, and robust. It follows best practices, including clear naming, consistent coding style, modular design, proper error handling, and adherence to coding standards. It’s also well-documented and easy to test and scale. Finally, high-quality code is efficient and secure, ensuring reliability and safe use.&lt;/p&gt;
&lt;p&gt;All the characteristics above allow developers to understand, modify, and extend a Python codebase with minimal effort.&lt;/p&gt;
&lt;h3 id=&quot;the-importance-of-code-quality&quot;&gt;The Importance of Code Quality&lt;a class=&quot;headerlink&quot; href=&quot;#the-importance-of-code-quality&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To understand why code quality matters, you’ll revisit the characteristics of high-quality code from the previous section and examine their impact:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Functional code&lt;/strong&gt;: Ensures correct behavior and expected outcomes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Readable code&lt;/strong&gt;: Makes understanding and maintaining code easier.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Documented code&lt;/strong&gt;: Clarifies the correct and recommended way for others to use it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compliant code&lt;/strong&gt;: Promotes consistency and allows collaboration.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reusable code&lt;/strong&gt;: Saves time by allowing code reuse.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Maintainable code&lt;/strong&gt;: Supports updates, improvements, and extensions with ease.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Robust code&lt;/strong&gt;: Minimizes crashes and produces fewer edge-case issues.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Testable code&lt;/strong&gt;: Simplifies verification of correctness through code testing. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Efficient code&lt;/strong&gt;: Runs faster and conserves system resources.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scalable code&lt;/strong&gt;: Supports growing projects and increasing data loads.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Secure code&lt;/strong&gt;: Provides safeguards against system loopholes and compromised inputs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The quality of your code matters because it produces code that’s easier to understand, modify, and extend over time. It leads to faster debugging, smoother feature development, reduced costs, and better user satisfaction while ensuring security and scalability.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-code-quality/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-code-quality/ »&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 Code Quality: Best Practices and Tools</title>
      <id>https://realpython.com/quizzes/python-code-quality/</id>
      <link href="https://realpython.com/quizzes/python-code-quality/"/>
      <updated>2025-03-24T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python code quality, tools, and best practices. By working through this quiz, you&#x27;ll revisit the importance of producing high-quality Python code that&#x27;s functional, readable, maintainable, efficient, and secure.</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/python-code-quality/&quot;&gt;Python Code Quality: Tools &amp;amp; Best Practices&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the importance of producing high-quality Python code that&amp;rsquo;s functional, readable, maintainable, efficient, and secure. You&amp;rsquo;ll also review how to use tools such as linters, formatters, and profilers to help achieve these qualities.&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 #244: A Decade of Automating the Boring Stuff With Python</title>
      <id>https://realpython.com/podcasts/rpp/244/</id>
      <link href="https://realpython.com/podcasts/rpp/244/"/>
      <updated>2025-03-21T12:00:00+00:00</updated>
      <summary>What goes into updating one of the most popular books about working with Python? After a decade of changes in the Python landscape, what projects, libraries, and skills are relevant to an office worker? This week on the show, we speak with previous guest Al Sweigart about the third edition of &quot;Automate the Boring Stuff With Python.&quot;</summary>
      <content type="html">
        &lt;p&gt;What goes into updating one of the most popular books about working with Python? After a decade of changes in the Python landscape, what projects, libraries, and skills are relevant to an office worker? This week on the show, we speak with previous guest Al Sweigart about the third edition of &quot;Automate the Boring Stuff With Python.&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: How to Strip Characters From a Python String</title>
      <id>https://realpython.com/quizzes/python-strip/</id>
      <link href="https://realpython.com/quizzes/python-strip/"/>
      <updated>2025-03-21T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s .strip(), .lstrip(), and .rstrip() methods, as well as .removeprefix() and .removesuffix(). These methods are useful for tasks like cleaning user input, standardizing filenames, and preparing data for storage.</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/python-strip/&quot;&gt;Python&amp;rsquo;s &lt;code&gt;.strip()&lt;/code&gt; method&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll also revisit the related methods &lt;code&gt;.lstrip()&lt;/code&gt; and &lt;code&gt;.rstrip()&lt;/code&gt;, as well as &lt;code&gt;.removeprefix()&lt;/code&gt; and &lt;code&gt;.removesuffix()&lt;/code&gt;. These methods are useful for tasks like cleaning user input, standardizing filenames, and preparing data for storage.&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>LangGraph: Build Stateful AI Agents in Python</title>
      <id>https://realpython.com/langgraph-python/</id>
      <link href="https://realpython.com/langgraph-python/"/>
      <updated>2025-03-19T14:00:00+00:00</updated>
      <summary>LangGraph is a versatile Python library designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. This tutorial will give you an overview of LangGraph fundamentals through hands-on examples, and the tools needed to build your own LLM workflows and agents in LangGraph.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;LangGraph is a versatile Python library designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. LangGraph builds upon its parent library, LangChain, and allows you to build sophisticated workflows that are capable of handling the complexities of real-world LLM applications.&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 LangGraph to build LLM workflows by &lt;strong&gt;defining state graphs with nodes and edges&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;LangGraph expands LangChain’s capabilities by providing tools to build complex LLM workflows with &lt;strong&gt;state, conditional edges, and cycles&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LLM agents&lt;/strong&gt; in LangGraph autonomously process tasks using state graphs to make decisions and interact with tools or APIs.&lt;/li&gt;
&lt;li&gt;You can use LangGraph independently of LangChain, although they’re often used together to complement each other.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Explore the full tutorial to gain hands-on experience with LangGraph, including setting up workflows and building a LangGraph agent that can autonomously parse emails, send emails, and interact with API services. &lt;/p&gt;
&lt;p&gt;While you’ll get a brief primer on &lt;a href=&quot;https://realpython.com/build-llm-rag-chatbot-with-langchain/&quot;&gt;LangChain&lt;/a&gt; in this tutorial, you’ll benefit from having prior knowledge of LangChain fundamentals. You’ll also want to ensure you have intermediate Python knowledge—specifically in &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; concepts like classes and methods.&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/langgraph-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-langgraph-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 build stateful AI agents with LangGraph 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.6eec2e95bede.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 “LangGraph: Build Stateful AI Agents 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/langgraph-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: #abe5b2;&quot; alt=&quot;LangGraph: Build Stateful AI Agents in Python&quot; src=&quot;https://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.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.6eec2e95bede.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/langgraph-python/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;LangGraph: Build Stateful AI Agents in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Take this quiz to test your understanding of LangGraph, a Python library designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. By working through this quiz, you&#x27;ll revisit how to build LLM workflows and agents in LangGraph.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;install-langgraph&quot;&gt;Install LangGraph&lt;a class=&quot;headerlink&quot; href=&quot;#install-langgraph&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;LangGraph is available on &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt;, and you can install it with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. Open a terminal or command prompt, create a new virtual environment, and then run the following command:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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 gp-VirtualEnv&quot;&gt;(venv)&lt;/span&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;langgraph
&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This command will install the latest version of LangGraph from PyPI onto your machine. To verify that the installation was successful, start a &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;Python REPL&lt;/a&gt; and import LangGraph:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;langgraph&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If the import runs without error, then you’ve successfully installed LangGraph. You’ll also need a few more libraries for this tutorial:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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 gp-VirtualEnv&quot;&gt;(venv)&lt;/span&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;langchain-openai&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;pydantic[email]&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You’ll use &lt;code&gt;langchain-openai&lt;/code&gt; to interact with OpenAI LLMs, but keep in mind that you can use any LLM provider you like with LangGraph and LangChain. You’ll use &lt;a href=&quot;https://realpython.com/python-pydantic/&quot;&gt;&lt;code&gt;pydantic&lt;/code&gt;&lt;/a&gt; to validate the information your agent parses from emails.&lt;/p&gt;
&lt;p&gt;Before moving forward, if you choose to use OpenAI, make sure you’re signed up for an OpenAI account and that you have a valid &lt;a href=&quot;https://openai.com/api/&quot;&gt;API key&lt;/a&gt;. You’ll need to set the following &lt;a href=&quot;https://en.wikipedia.org/wiki/Environment_variable&quot;&gt;environment variable&lt;/a&gt; before running any examples in this tutorial:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;dotenv&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--grey&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;.env&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&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;na&quot;&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;lt;YOUR-OPENAI-API-KEY&amp;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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note that while LangGraph was made by the creators of LangChain, and the two libraries are highly compatible, it’s possible to use LangGraph without LangChain. However, it’s more common to use LangChain and LangGraph together, and you’ll see throughout this tutorial how they complement each other.&lt;/p&gt;
&lt;p&gt;With that, you’ve installed all the dependencies you’ll need for this tutorial, and you’re ready to create your LangGraph email processor. Before diving in, you’ll take a brief detour to set up quick sanity tests for your app. Then, you’ll go through an overview of LangChain chains and explore LangGraph’s core concept—the state graph.&lt;/p&gt;
&lt;h2 id=&quot;create-test-cases&quot;&gt;Create Test Cases&lt;a class=&quot;headerlink&quot; href=&quot;#create-test-cases&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When developing AI applications, testing and performance tracking is crucial for understanding how your chain, graph, or agent performs in the real world. While performance tracking is out of scope for this tutorial, you’ll use several example emails to test your chains, graphs, and agent, and you’ll empirically inspect whether their outputs are correct. &lt;/p&gt;
&lt;p&gt;To avoid redefining these examples each time, create the following Python file with example emails:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between 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;example_emails.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&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;EMAILS&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;c1&quot;&gt;# Email 0&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;    Date: October 15, 2024&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    From: Occupational Safety and Health Administration (OSHA)&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    To: Blue Ridge Construction, project 111232345 - Downtown Office&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Complex Location: Dallas, TX&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;    During a recent inspection of your construction site at 123 Main&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Street,&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    the following safety violations were identified:&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;    Lack of fall protection: Workers on scaffolding above 10 feet&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    were without required harnesses or other fall protection&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    equipment. Unsafe scaffolding setup: Several scaffolding&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    structures were noted as&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    lacking secure base plates and bracing, creating potential&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    collapse risks.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Inadequate personal protective equipment (PPE): Multiple&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    workers were&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    found without proper PPE, including hard hats and safety&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    glasses.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Required Corrective Actions:&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;    Install guardrails and fall arrest systems on all scaffolding&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    over 10 feet. Conduct an inspection of all scaffolding&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    structures and reinforce unstable sections. Ensure all&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    workers on-site are provided&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    with necessary PPE and conduct safety training on proper&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    usage.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Deadline for Compliance: All violations must be rectified&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    by November 10, 2024. Failure to comply may result in fines&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    of up to&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    $25,000 per violation.&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;    Contact: For questions or to confirm compliance, please reach&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    out to the&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    OSHA regional office at (555) 123-4567 or email&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    compliance.osha@osha.gov.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    &quot;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Email 1&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;    From: debby@stack.com&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Hey Betsy,&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Here&#x27;s your invoice for $1000 for the cookies you ordered.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    &quot;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Email 2&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;    From: tdavid@companyxyz.com&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Hi Paul,&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    We have an issue with the HVAC system your team installed in&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    apartment 1235. We&#x27;d like to request maintenance or a refund.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Thanks,&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Terrance&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    &quot;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Email 3&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;    Date: January 10, 2025&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    From: City of Los Angeles Building and Safety Department&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    To: West Coast Development, project 345678123 - Sunset Luxury&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Condominiums&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Location: Los Angeles, CA&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Following an inspection of your site at 456 Sunset Boulevard, we have&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    identified the following building code violations:&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Electrical Wiring: Exposed wiring was found in the underground parking&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    garage, posing a safety hazard. Fire Safety: Insufficient fire&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    extinguishers were available across multiple floors of the structure&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    under construction.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Structural Integrity: The temporary support beams in the eastern wing&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    do not meet the load-bearing standards specified in local building&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    codes.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Required Corrective Actions:&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Replace or properly secure exposed wiring to meet electrical safety&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    standards. Install additional fire extinguishers in compliance with&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    fire code requirements. Reinforce or replace temporary support beams&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    to ensure structural stability. Deadline for Compliance: Violations&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    must be addressed no later than February 5,&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    2025. Failure to comply may result in&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    a stop-work order and additional fines.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Contact: For questions or to schedule a re-inspection, please contact&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    the Building and Safety Department at&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    (555) 456-7890 or email inspections@lacity.gov.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    &quot;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can read through these right now if you want, but you’ll get links back to these test emails throughout the tutorial.&lt;/p&gt;
&lt;h2 id=&quot;work-with-state-graphs&quot;&gt;Work With State Graphs&lt;a class=&quot;headerlink&quot; href=&quot;#work-with-state-graphs&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/langgraph-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/langgraph-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&#x27;s Bytearray</title>
      <id>https://realpython.com/quizzes/python-bytearray/</id>
      <link href="https://realpython.com/quizzes/python-bytearray/"/>
      <updated>2025-03-19T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s bytearray data type. By working through this quiz, you&#x27;ll revisit the key concepts and uses of bytearray in Python.</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/python-bytearray/&quot;&gt;Python&amp;rsquo;s Bytearray: A Mutable Sequence of Bytes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the key concepts and uses of &lt;code&gt;bytearray&lt;/code&gt; in Python.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using Structural Pattern Matching in Python</title>
      <id>https://realpython.com/courses/structural-pattern-matching/</id>
      <link href="https://realpython.com/courses/structural-pattern-matching/"/>
      <updated>2025-03-18T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to harness the power of structural pattern matching in Python. You&#x27;ll explore the new syntax, delve into various pattern types, and find appropriate applications for pattern matching, all while identifying common pitfalls.</summary>
      <content type="html">
        &lt;p&gt;Structural pattern matching is a powerful &lt;strong&gt;control flow construct&lt;/strong&gt; invented decades ago that&amp;rsquo;s traditionally used by compiled languages, especially within the &lt;a href=&quot;https://realpython.com/python-functional-programming/&quot;&gt;functional programming paradigm&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Most mainstream programming languages have since adopted some form of pattern matching, which offers concise and readable syntax while promoting a declarative code style. Although Python was late to join the party, it introduced structural pattern matching in the &lt;a href=&quot;https://realpython.com/python310-new-features/&quot;&gt;3.10&lt;/a&gt; release.&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;Master the &lt;strong&gt;syntax&lt;/strong&gt; of the &lt;code&gt;match&lt;/code&gt; statement and &lt;code&gt;case&lt;/code&gt; clauses&lt;/li&gt;
&lt;li&gt;Explore various &lt;strong&gt;types of patterns&lt;/strong&gt; supported by Python&lt;/li&gt;
&lt;li&gt;Learn about &lt;strong&gt;guards&lt;/strong&gt;, &lt;strong&gt;unions&lt;/strong&gt;, &lt;strong&gt;aliases&lt;/strong&gt;, and &lt;strong&gt;name binding&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Extract values from deeply nested &lt;strong&gt;hierarchical data structures&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Customize pattern matching for &lt;strong&gt;user-defined classes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Identify and avoid &lt;strong&gt;common pitfalls&lt;/strong&gt; in Python&amp;rsquo;s pattern matching&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s Instance, Class, and Static Methods Demystified</title>
      <id>https://realpython.com/instance-class-and-static-methods-demystified/</id>
      <link href="https://realpython.com/instance-class-and-static-methods-demystified/"/>
      <updated>2025-03-17T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll compare Python&#x27;s instance methods, class methods, and static methods. You&#x27;ll gain an understanding of when and how to use each method type to write clear and maintainable object-oriented code.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Instance, class, and static methods each serve a distinct role in Python, and knowing when to use one over another is key to writing clean, maintainable code. Instance methods operate on individual objects using &lt;code&gt;self&lt;/code&gt;, while class methods use &lt;code&gt;cls&lt;/code&gt; to access class-level data. Static methods, on the other hand, provide organizational structure without relying on class or instance state. &lt;/p&gt;
&lt;p&gt;When you understand the differences between these three method types, you’ll be in a better spot to know when to write an instance method, class method, or a static method. Ultimately, this’ll help you design better maintainable object-oriented Python code.&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;Instance methods&lt;/strong&gt; access the state of a &lt;strong&gt;specific object&lt;/strong&gt; through the &lt;strong&gt;&lt;code&gt;self&lt;/code&gt;&lt;/strong&gt; parameter.&lt;/li&gt;
&lt;li&gt;You create &lt;strong&gt;class methods&lt;/strong&gt; with the &lt;strong&gt;&lt;code&gt;@classmethod&lt;/code&gt;&lt;/strong&gt; decorator and use them for operations that involve &lt;strong&gt;class-level data&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You use &lt;strong&gt;static methods&lt;/strong&gt; for &lt;strong&gt;utility functionality&lt;/strong&gt; that doesn’t need class or instance data, and you create them with the &lt;strong&gt;&lt;code&gt;@staticmethod&lt;/code&gt;&lt;/strong&gt; decorator.&lt;/li&gt;
&lt;li&gt;Using class methods and static methods in your classes can &lt;strong&gt;improve class design&lt;/strong&gt; and code maintainability.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Keep reading to see all three method types in action. You’ll even bake some digital pizza while working on a real-world example with all three method types in a &lt;code&gt;Pizza&lt;/code&gt; class.
If you develop an intuitive understanding for their differences, you’ll be able to write &lt;a href=&quot;/ref/glossary/oop/&quot; class=&quot;ref-link&quot;&gt;object-oriented&lt;/a&gt; Python code that communicates its intent more clearly and is easier to maintain in the long run.&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/instance-class-and-static-methods-demystified-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-instance-class-and-static-methods-demystified-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code &lt;/a&gt; you’ll use to learn about instance, class, and static methods 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.6eec2e95bede.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&#x27;s Instance, Class, and Static Methods Demystified” 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/instance-class-and-static-methods-demystified/&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;Python classmethods, staticmethods, and instance methods&quot; src=&quot;https://files.realpython.com/media/Pythons-Instance-Class-and-Static-Methods-Demystified_Watermarked.5bce71bc29d0.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Pythons-Instance-Class-and-Static-Methods-Demystified_Watermarked.5bce71bc29d0.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Pythons-Instance-Class-and-Static-Methods-Demystified_Watermarked.5bce71bc29d0.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Pythons-Instance-Class-and-Static-Methods-Demystified_Watermarked.5bce71bc29d0.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Pythons-Instance-Class-and-Static-Methods-Demystified_Watermarked.5bce71bc29d0.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.6eec2e95bede.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/instance-class-and-static-methods-demystified/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python&#x27;s Instance, Class, and Static Methods Demystified&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 instance, class, and static methods in Python. By working through this quiz, you&#x27;ll revisit the differences between these methods and how to use them effectively in your Python code.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;compare-instance-methods-vs-class-methods-vs-static-methods&quot;&gt;Compare Instance Methods vs Class Methods vs Static Methods&lt;a class=&quot;headerlink&quot; href=&quot;#compare-instance-methods-vs-class-methods-vs-static-methods&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you’re here for a quick reminder of how the three method types differ from one another, then consider the following overview that compares them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instance methods&lt;/strong&gt; use a &lt;code&gt;self&lt;/code&gt; parameter pointing to an &lt;a href=&quot;/ref/glossary/instance/&quot; class=&quot;ref-link&quot;&gt;instance&lt;/a&gt; of the &lt;a href=&quot;/ref/glossary/class/&quot; class=&quot;ref-link&quot;&gt;class&lt;/a&gt;. They can access and modify instance state through &lt;code&gt;self&lt;/code&gt; and class state through &lt;code&gt;self.__class__&lt;/code&gt;. These are the most common methods in Python classes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Class methods&lt;/strong&gt; use a &lt;code&gt;cls&lt;/code&gt; parameter pointing to the class itself. They can modify class-level state through &lt;code&gt;cls&lt;/code&gt;, but they can’t modify individual instance state.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Static methods&lt;/strong&gt; don’t take &lt;code&gt;self&lt;/code&gt; or &lt;code&gt;cls&lt;/code&gt; parameters. They can’t modify instance or class state directly, and you’ll mainly use them for organizational purposes and namespacing.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you need to revisit information quickly, there’s nothing quite like a table. So here are the most important aspects of the three different types of methods in Python classes summed up in a table:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Decorator&lt;/th&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Instance Access&lt;/th&gt;
&lt;th&gt;Class Access&lt;/th&gt;
&lt;th&gt;Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Instance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;None needed&lt;/td&gt;
&lt;td&gt;&lt;code&gt;self&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Operations on individual instances.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Class&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;@classmethod&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Factory methods, alternative constructors, or any method that deals with class-level data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Static&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;@staticmethod&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;No &lt;code&gt;self&lt;/code&gt; or &lt;code&gt;cls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;Utility methods that don’t need instance or class data.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;That’s enough super-condensed, repetitive reference information! If you want to know what all of this means in practice, and you like to learn by running code snippets and reasoning about them, then keep on reading.&lt;/p&gt;
&lt;p&gt;Next, you’ll explore the differences between instance, class, and static methods in a somewhat abstract code example. Abstract you say? Don’t worry—it involves runnable code, and it’s there to set the stage for a more practical example later on.&lt;/p&gt;
&lt;h2 id=&quot;gain-insight-through-an-abstract-example&quot;&gt;Gain Insight Through an Abstract Example&lt;a class=&quot;headerlink&quot; href=&quot;#gain-insight-through-an-abstract-example&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To get warmed up, you’ll write a small Python file called &lt;code&gt;demo.py&lt;/code&gt; with a bare-bones Python class that contains stripped-down examples of all three method types:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between 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;demo.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&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;DemoClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;instance_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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;instance method called&quot;&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;nd&quot;&gt;@classmethod&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;class_method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;cls&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;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;class method called&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;cls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;nd&quot;&gt;@staticmethod&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;static_method&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;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;static method called&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Inside &lt;code&gt;demo.py&lt;/code&gt;, you create &lt;code&gt;DemoClass&lt;/code&gt;—a descriptively named custom class with the sole purpose of demoing the differences between instance methods, class methods, and static methods.&lt;/p&gt;
&lt;p&gt;Consequently, you also implement one of each of the three method types and name them accordingly. They each return a &lt;a href=&quot;https://realpython.com/python-tuple/&quot;&gt;tuple&lt;/a&gt; containing information to help you trace what’s going on, as well as the arguments the method received, such as &lt;code&gt;self&lt;/code&gt; and &lt;code&gt;cls&lt;/code&gt;. The output will help you understand which &lt;a href=&quot;/ref/glossary/object/&quot; class=&quot;ref-link&quot;&gt;objects&lt;/a&gt; each of the methods can access.&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; Naming these parameters &lt;code&gt;self&lt;/code&gt; and &lt;code&gt;cls&lt;/code&gt; is just a convention—but it’s a strong one in the Python community! You could name them &lt;code&gt;foo&lt;/code&gt; and &lt;code&gt;bar&lt;/code&gt; and get the same result. However, if you stray from the convention, then you may get disapproving looks from your coworkers or anyone reading your code.&lt;/p&gt;
&lt;p&gt;For functionality, all that matters is that you position them first in the parameter list for the method. For maintainability, sanity, and out of respect for others, you should always use &lt;code&gt;self&lt;/code&gt; and &lt;code&gt;cls&lt;/code&gt; in the classes you define.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now it’s time to call these demo methods in a new &lt;a href=&quot;/ref/glossary/repl/&quot; class=&quot;ref-link&quot;&gt;REPL&lt;/a&gt; session. Import &lt;code&gt;DemoClass&lt;/code&gt; and create an instance of it, then start by calling the &lt;strong&gt;instance method&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;from&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;demo&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DemoClass&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;obj&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DemoClass&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;obj&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instance_method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(&#x27;instance method called&#x27;, &amp;lt;demo.DemoClass object at 0x100a30d70&amp;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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The output confirms that &lt;code&gt;.instance_method()&lt;/code&gt; has access to the object instance through the &lt;code&gt;self&lt;/code&gt; argument. Python prints the object instance as &lt;code&gt;&amp;lt;demo.DemoClass object at 0x100a30d70&amp;gt;&lt;/code&gt;. When you call the instance method, Python replaces the &lt;code&gt;self&lt;/code&gt; argument with the instance object, &lt;code&gt;obj&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Instance methods can also access the class itself through the &lt;code&gt;self.__class__&lt;/code&gt; attribute. This makes instance methods powerful in terms of access restrictions. They can modify state on the object instance &lt;em&gt;and&lt;/em&gt; on the class itself.&lt;/p&gt;
&lt;p&gt;Next, you can try out the &lt;strong&gt;class method&lt;/strong&gt;:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/instance-class-and-static-methods-demystified/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/instance-class-and-static-methods-demystified/ »&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: Introducing DuckDB</title>
      <id>https://realpython.com/quizzes/introducing-duckdb/</id>
      <link href="https://realpython.com/quizzes/introducing-duckdb/"/>
      <updated>2025-03-17T12:00:00+00:00</updated>
      <summary>This quiz will challenge your knowledge of working with DuckDB. You won&#x27;t find all the answers in the tutorial, so you&#x27;ll need to do some extra investigation. By finding all the answers, you&#x27;re sure to learn some interesting things along the way.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of the techniques discussed in the &lt;a href=&quot;https://realpython.com/python-duckdb/&quot;&gt;Introducing DuckDB&lt;/a&gt; tutorial.&lt;/p&gt;
&lt;p&gt;As you work through the questions, you&amp;rsquo;ll review your knowledge of DuckDB and build on what you learned in the tutorial.&lt;/p&gt;
&lt;p&gt;To successfully answer all the questions, you&amp;rsquo;ll need to do some research outside of the tutorial. Embrace this challenge and allow it to enhance your learning journey.&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: LangGraph: Build Stateful AI Agents in Python</title>
      <id>https://realpython.com/quizzes/langgraph-python/</id>
      <link href="https://realpython.com/quizzes/langgraph-python/"/>
      <updated>2025-03-17T12:00:00+00:00</updated>
      <summary>Take this quiz to test your understanding of LangGraph, a Python library designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. By working through this quiz, you&#x27;ll revisit how to build LLM workflows and agents in LangGraph.</summary>
      <content type="html">
        &lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to &lt;a href=&quot;https://realpython.com/langgraph-python/&quot;&gt;build LLM workflows and agents in LangGraph&lt;/a&gt;, and how LangGraph expands upon LangChain&amp;rsquo;s capabilities.&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 #243: Manage Projects With pyproject.toml &amp; Explore Polars LazyFrames</title>
      <id>https://realpython.com/podcasts/rpp/243/</id>
      <link href="https://realpython.com/podcasts/rpp/243/"/>
      <updated>2025-03-14T12:00:00+00:00</updated>
      <summary>How can you simplify the management of your Python projects with one file? What are the advantages of using LazyFrames in Polars? 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 can you simplify the management of your Python projects with one file? What are the advantages of using LazyFrames in Polars? 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 Textual: Build Beautiful UIs in the Terminal</title>
      <id>https://realpython.com/python-textual/</id>
      <link href="https://realpython.com/python-textual/"/>
      <updated>2025-03-12T14:00:00+00:00</updated>
      <summary>Textual is a Python library for building text-based user interfaces (TUIs) that support rich text, advanced layouts, and event-driven interactivity in the terminal. This tutorial showcases some of the ways you can design an appealing and engaging UI using Textual.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Have you ever wanted to create an app with an appealing interface that works in the command line? Welcome to Textual, a Python toolkit and framework for creating beautiful, functional &lt;strong&gt;text-based user interface (TUI)&lt;/strong&gt; applications. The Textual library provides a powerful and flexible framework for building TUIs. It offers a variety of features that allow you to create interactive and engaging console applications.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn how to create, style, and enhance Textual apps with layouts, events, and actions.&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;Python Textual&lt;/strong&gt; is a framework for building terminal-based applications with interactive and visually appealing text interfaces.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Textual works&lt;/strong&gt; by providing a set of widgets, layouts, and styling options, enabling you to create responsive and interactive console apps.&lt;/li&gt;
&lt;li&gt;Textual is useful for building efficient, &lt;strong&gt;platform-independent text-based user interfaces&lt;/strong&gt; that work over remote connections and in low-resource environments.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Textual is built on &lt;a href=&quot;https://realpython.com/python-rich-package/&quot;&gt;Rich&lt;/a&gt;, a Python library for creating rich text and beautifully formatted terminal output. It enhances text-based applications by applying colors, styles, and formatting to your text output in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-textual-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-textual-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 Textual to Build Beautiful UIs in the Terminal.&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.6eec2e95bede.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 Textual: Build Beautiful UIs in the Terminal” 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-textual/&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;Python Textual: Build Beautiful UIs in the Terminal&quot; src=&quot;https://files.realpython.com/media/Showcase-Textual_Watermarked.2ccb0c0dd46e.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Showcase-Textual_Watermarked.2ccb0c0dd46e.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Showcase-Textual_Watermarked.2ccb0c0dd46e.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Showcase-Textual_Watermarked.2ccb0c0dd46e.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Showcase-Textual_Watermarked.2ccb0c0dd46e.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.6eec2e95bede.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-textual/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Textual: Build Beautiful UIs in the Terminal&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 Python Textual library. This library is used to create rich terminal applications and widgets. By working through this quiz, you&#x27;ll reinforce your knowledge of Textual&#x27;s key concepts and features.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;installing-textual&quot;&gt;Installing Textual&lt;a class=&quot;headerlink&quot; href=&quot;#installing-textual&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Textual requires Python 3.8 or later to work. As with any new Python project, it’s a good idea to create a &lt;strong&gt;virtual environment&lt;/strong&gt; before you start. This helps keep your system’s Python environment clean and prevents unnecessary dependencies that may cause trouble later on.&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 Python virtual environments, check out &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Once you have the Python virtual environment, you can install Textual from &lt;a href=&quot;/ref/glossary/pypi/&quot; class=&quot;ref-link&quot;&gt;PyPI&lt;/a&gt; using &lt;code&gt;pip&lt;/code&gt;, which is the package installer for Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To learn more about &lt;code&gt;pip&lt;/code&gt;, check out &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;Using Python’s pip to Manage Your Projects’ Dependencies&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Open a &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;command-line console&lt;/a&gt; and create a directory to host your Textual code. Then, run the commands below to create a virtual environment, activate it, and install Textual:&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.6eec2e95bede.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.6eec2e95bede.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.6eec2e95bede.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;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;venv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Scripts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;activate&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&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;textual&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;textual-dev&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;venv&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&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;textual&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;textual-dev
&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Here, you first create a virtual environment using the &lt;code&gt;venv&lt;/code&gt; module from the standard library. Then, you activate it, and finally, you install Textual using &lt;code&gt;pip&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You’ve installed two packages:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;textual&lt;/code&gt;&lt;/strong&gt; is the library and application framework that’ll provide the machinery for your TUI applications.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;textual-dev&lt;/code&gt;&lt;/strong&gt; contains a command-line tool, also named &lt;code&gt;textual&lt;/code&gt;, that facilitates debugging and interactive development through the &lt;strong&gt;Textual console&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In what follows, you’ll mostly be using the &lt;code&gt;textual&lt;/code&gt; library, but you’ll also see an example of how to use the &lt;code&gt;textual&lt;/code&gt; tool from &lt;code&gt;textual-dev&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;checking-the-textual-installation&quot;&gt;Checking the Textual Installation&lt;a class=&quot;headerlink&quot; href=&quot;#checking-the-textual-installation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;textual&lt;/code&gt; package is now installed in your Python virtual environment. You can check your installation by running the following command:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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 gp-VirtualEnv&quot;&gt;(venv)&lt;/span&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;textual
&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You should see the Textual demo app, a nicely formatted TUI application that displays useful information about Textual’s capabilities. You can interact with it using the mouse or keys:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 &quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/1040429316?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;Notice the colored text, emojis, structured layout, and the keyboard shortcuts listed in the window footer. There’s a lot to explore here, but for now, you’re going to dive right in and create your first app using Textual. You can close the demo by pressing &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-control&quot;&gt;Ctrl&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-c&quot;&gt;C&lt;/kbd&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-textual/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-textual/ »&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>Getting to Know Duck Typing in Python</title>
      <id>https://realpython.com/courses/duck-typing-python/</id>
      <link href="https://realpython.com/courses/duck-typing-python/"/>
      <updated>2025-03-11T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about duck typing in Python---a type system based on an object&#x27;s behavior rather than inheritance. By taking advantage of duck typing, you can create flexible and decoupled sets of Python classes that work together or independently.</summary>
      <content type="html">
        &lt;p&gt;Python makes extensive use of a &lt;a href=&quot;https://realpython.com/python-type-checking/#type-systems&quot;&gt;type system&lt;/a&gt; known as &lt;strong&gt;duck typing&lt;/strong&gt;. This system is based on an object&amp;rsquo;s behavior and interface. Many built-in classes and tools support this type system, which makes them pretty flexible and decoupled.&lt;/p&gt;
&lt;p&gt;Duck typing is a core concept in Python. Understanding it will give you deeper insight into how the language works and, more importantly, how to use this approach in your own code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;duck typing&lt;/strong&gt; is and what its pros and cons are&lt;/li&gt;
&lt;li&gt;How Python&amp;rsquo;s classes and tools &lt;strong&gt;take advantage of duck typing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;special methods&lt;/strong&gt; and &lt;strong&gt;protocols&lt;/strong&gt; support duck typing&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;alternatives&lt;/strong&gt; to duck typing are in Python&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python News Roundup: March 2025</title>
      <id>https://realpython.com/python-news-march-2025/</id>
      <link href="https://realpython.com/python-news-march-2025/"/>
      <updated>2025-03-10T14:00:00+00:00</updated>
      <summary>Last month, Python published the fifth alpha version of the 3.14 series. The PSF shared their online platforms, and PyCon US 2025 published its schedule. Some fundamental Python projects, such as Django and IPython, also released new versions.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Spring isn’t the only thing in the air—new Python releases are here! Last month, Python’s core development team released versions &lt;strong&gt;3.13.2&lt;/strong&gt;, &lt;strong&gt;3.12.9&lt;/strong&gt;, and &lt;strong&gt;3.14.0 alpha 5&lt;/strong&gt; of the language. The 3.14.0a5 version is the fifth of seven planned alpha releases. You can install this alpha release to try some new and exciting language features.&lt;/p&gt;
&lt;p&gt;The PyPy project has also released a new version—&lt;strong&gt;7.3.19&lt;/strong&gt;—featuring interpreters for Python 2.7, 3.10, and the newly introduced Python 3.11.&lt;/p&gt;
&lt;p&gt;There’s also news from the Python Software Foundation (PSF), PyCon US 2025, PyCascades 2025, and the Python ecosystem.&lt;/p&gt;
&lt;p&gt;Let’s dive in and explore 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 update, or post.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;python-core-team-releases-bugfix-versions-3132-and-3129&quot;&gt;Python Core Team Releases Bugfix Versions 3.13.2 and 3.12.9&lt;a class=&quot;headerlink&quot; href=&quot;#python-core-team-releases-bugfix-versions-3132-and-3129&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On February 4, 2025, Python &lt;a href=&quot;https://www.python.org/downloads/release/python-3132/&quot;&gt;3.13.2&lt;/a&gt; was released as the second maintenance update for the 3.13 series. Packed with nearly 250 bug fixes and refinements, this release makes Python 3.13 even more stable and developer-friendly.&lt;/p&gt;
&lt;p&gt;Python 3.13 introduces significant features and optimizations over Python 3.12, including an improved &lt;a href=&quot;https://realpython.com/python313-repl/&quot;&gt;interactive interpreter&lt;/a&gt; and experimental &lt;a href=&quot;https://realpython.com/python313-free-threading-jit/&quot;&gt;free-threaded&lt;/a&gt; build mode. Explore the full &lt;a href=&quot;https://docs.python.org/release/3.13.2/whatsnew/changelog.html#python-3-13-2&quot;&gt;changelog&lt;/a&gt; for detailed updates and changes in this bugfix release.&lt;/p&gt;
&lt;p&gt;On a similar note, Python &lt;a href=&quot;https://www.python.org/downloads/release/python-3129/&quot;&gt;3.12.9&lt;/a&gt; was also released on February 4, 2025. It marks the ninth maintenance update in the 3.12 series. This release includes approximately 180 bug fixes, build improvements, and documentation updates since the previous release.&lt;/p&gt;
&lt;p&gt;As always, the Python development team continues to enhance the language’s stability and performance with each release. For more details, refer to the &lt;a href=&quot;https://docs.python.org/release/3.12.9/whatsnew/changelog.html#python-3-12-9&quot;&gt;full changelog&lt;/a&gt;. You can also support Python’s ongoing development through &lt;a href=&quot;https://www.python.org/psf/donations/python-dev/&quot;&gt;donations&lt;/a&gt; or &lt;a href=&quot;https://github.com/sponsors/python&quot;&gt;sponsorship&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;python-314-series-releases-fifth-alpha-version&quot;&gt;Python 3.14 Series Releases Fifth Alpha Version&lt;a class=&quot;headerlink&quot; href=&quot;#python-314-series-releases-fifth-alpha-version&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Python development team unveiled the &lt;a href=&quot;https://pythoninsider.blogspot.com/2025/02/python-3140-alpha-5-is-out.html&quot;&gt;fifth alpha release&lt;/a&gt; of Python 3.14 on February 11, 2025. This release is part of a series of seven planned alpha releases aimed at testing new features, bug fixes, and the release process before moving into the beta phase on May 6, 2025.&lt;/p&gt;
&lt;p&gt;It’s important to note that this preview is not recommended for production environments. If you’re curious about the future of Python, &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;installing&lt;/a&gt; this alpha version lets you explore the upcoming features before the final release. You’re encouraged to report any bugs via Python’s &lt;a href=&quot;https://github.com/python/cpython/issues&quot;&gt;issues page&lt;/a&gt;. Again, for a detailed list of changes, check the &lt;a href=&quot;https://docs.python.org/3.14/whatsnew/3.14.html&quot;&gt;full changelog&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;pypy-team-releases-version-7319&quot;&gt;PyPy Team Releases Version 7.3.19&lt;a class=&quot;headerlink&quot; href=&quot;#pypy-team-releases-version-7319&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-march-2025/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-march-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>The Real Python Podcast – Episode #242: Eric Matthes: Maybe Don&#x27;t Start With Unit Tests</title>
      <id>https://realpython.com/podcasts/rpp/242/</id>
      <link href="https://realpython.com/podcasts/rpp/242/"/>
      <updated>2025-03-07T12:00:00+00:00</updated>
      <summary>Should you always start testing your code with unit tests? When does it make sense to look at integration or end-to-end testing as a first step instead? This week on the show, we speak with previous guest Eric Matthes about where to begin testing your code.</summary>
      <content type="html">
        &lt;p&gt;Should you always start testing your code with unit tests? When does it make sense to look at integration or end-to-end testing as a first step instead? This week on the show, we speak with previous guest Eric Matthes about where to begin testing your code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Bytes Objects: Handling Binary Data in Python</title>
      <id>https://realpython.com/python-bytes/</id>
      <link href="https://realpython.com/python-bytes/"/>
      <updated>2025-03-05T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about Python&#x27;s bytes objects, which help you process low-level binary data. You&#x27;ll explore how to create and manipulate byte sequences in Python and how to convert between bytes and strings. Additionally, you&#x27;ll practice this knowledge by coding a few fun examples.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;code&gt;bytes&lt;/code&gt; data type is an immutable sequence of unsigned bytes used for handling binary data in Python. You can create a &lt;code&gt;bytes&lt;/code&gt; object using the literal syntax, the &lt;code&gt;bytes()&lt;/code&gt; function, or the &lt;code&gt;bytes.fromhex()&lt;/code&gt; method. Since &lt;code&gt;bytes&lt;/code&gt; are closely related to strings, you often convert between the two data types, applying the correct character encoding.&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;Python &lt;code&gt;bytes&lt;/code&gt; objects&lt;/strong&gt; are immutable sequences of unsigned bytes used for handling binary data.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;difference between &lt;code&gt;bytes&lt;/code&gt; and &lt;code&gt;bytearray&lt;/code&gt;&lt;/strong&gt; is that &lt;code&gt;bytes&lt;/code&gt; objects are read-only, while &lt;code&gt;bytearray&lt;/code&gt; objects are mutable.&lt;/li&gt;
&lt;li&gt;You convert a &lt;strong&gt;Python string to &lt;code&gt;bytes&lt;/code&gt;&lt;/strong&gt; using the &lt;code&gt;str.encode()&lt;/code&gt; method, the &lt;code&gt;bytes()&lt;/code&gt; function, or the &lt;code&gt;codecs&lt;/code&gt; module.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Endianness&lt;/strong&gt; refers to the byte order used to represent binary data in memory, which can be either little-endian or big-endian.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial starts with a brief overview of binary data fundamentals, setting the scene for the remaining part, which delves into creating and manipulating &lt;code&gt;bytes&lt;/code&gt; objects in Python. Along the way, it touches on related topics, such as &lt;code&gt;bytearray&lt;/code&gt;, bytes-like objects, and the buffer protocol. To top it off, you’ll find several real-life examples and exercises at the end, which demonstrate the concepts discussed.&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should be familiar with &lt;a href=&quot;https://realpython.com/python-basics-paperback/&quot;&gt;Python basics&lt;/a&gt;, particularly &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;built-in data types&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;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-bytes-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-bytes-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 about bytes objects and handling binary 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.6eec2e95bede.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 Bytes” 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-bytes/&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: #abe0e6;&quot; alt=&quot;Bytes Objects: Handling Binary Data in Python&quot; src=&quot;https://files.realpython.com/media/Pythons-Bytes-Data-Type_Watermarked.f92d44bd7034.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Pythons-Bytes-Data-Type_Watermarked.f92d44bd7034.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Pythons-Bytes-Data-Type_Watermarked.f92d44bd7034.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Pythons-Bytes-Data-Type_Watermarked.f92d44bd7034.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Pythons-Bytes-Data-Type_Watermarked.f92d44bd7034.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.6eec2e95bede.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-bytes/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Bytes&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 Python bytes objects. By working through this quiz, you&#x27;ll revisit the key concepts related to this low-level data type.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;brushing-up-on-binary-fundamentals&quot;&gt;Brushing Up on Binary Fundamentals&lt;a class=&quot;headerlink&quot; href=&quot;#brushing-up-on-binary-fundamentals&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you’re new to binary data or need a quick refresher, then consider sticking around. This section will provide a brief overview of binary representations, emphasizing a Python programmer’s perspective. On the other hand, if you’re already comfortable with the basics, then feel free to dive right into &lt;a href=&quot;#creating-python-bytes-by-hand&quot;&gt;creating &lt;code&gt;bytes&lt;/code&gt; objects&lt;/a&gt; in Python.&lt;/p&gt;
&lt;h3 id=&quot;bits-bytes-and-binary-data&quot;&gt;Bits, Bytes, and Binary Data&lt;a class=&quot;headerlink&quot; href=&quot;#bits-bytes-and-binary-data&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Virtually every piece of information, from books and music to movies, can be stored as &lt;strong&gt;binary data&lt;/strong&gt; in a computer’s memory. The word &lt;em&gt;binary&lt;/em&gt; implies that the information is stored as a sequence of &lt;a href=&quot;https://en.wikipedia.org/wiki/Binary_number&quot;&gt;binary digits&lt;/a&gt;, or &lt;strong&gt;bits&lt;/strong&gt; for short. Each bit can hold a value of either one or zero, which is particularly well-suited for storage in electronic devices since they often use distinct voltage levels to represent these binary states.&lt;/p&gt;
&lt;p&gt;For example, the binary sequence below may represent the color of a pixel in an image:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th class=&quot;text-center d-none&quot;&gt; &lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-center border-0&quot;&gt;&lt;code&gt;1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 1 0 0 1 0 0 1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;To make the interpretation of such binary sequences more systematic, you often arrange the individual bits into uniform groups. The standard unit of information in modern computing consists of exactly eight bits, which is why it’s sometimes known as an &lt;a href=&quot;https://en.wikipedia.org/wiki/Octet_(computing)&quot;&gt;octet&lt;/a&gt;, although most people call it a &lt;strong&gt;byte&lt;/strong&gt;. A single 8-bit byte allows for 256 possible bit combinations (2&lt;sup&gt;8&lt;/sup&gt;).&lt;/p&gt;
&lt;p&gt;With this in mind, you can break up the bit sequence above into these three bytes:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th class=&quot;text-right d-none&quot;&gt; &lt;/th&gt;
&lt;th class=&quot;text-center d-none&quot;&gt; &lt;/th&gt;
&lt;th class=&quot;text-left d-none&quot;&gt; &lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-right border-0&quot;&gt;&lt;code&gt;0 0 1 1 0 0 0 0&lt;/code&gt;&lt;/td&gt;
&lt;td class=&quot;text-center border-0&quot;&gt;&lt;code&gt;1 0 0 0 1 1 0 0&lt;/code&gt;&lt;/td&gt;
&lt;td class=&quot;text-left border-0&quot;&gt;&lt;code&gt;1 1 0 0 1 0 0 1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Notice that the leftmost byte has been padded with two leading zeros to ensure a consistent number of bits across all bytes. Together, they form a &lt;a href=&quot;https://en.wikipedia.org/wiki/Color_depth#True_color_(24-bit)&quot;&gt;24-bit color depth&lt;/a&gt;, letting you choose from more than 16 million (2&lt;sup&gt;24&lt;/sup&gt;) unique colors per pixel.&lt;/p&gt;
&lt;p&gt;In this case, each byte corresponds to one of three &lt;a href=&quot;https://en.wikipedia.org/wiki/Primary_color&quot;&gt;primary colors&lt;/a&gt; (red, green, and blue) within the &lt;a href=&quot;https://en.wikipedia.org/wiki/RGB_color_model&quot;&gt;RGB color model&lt;/a&gt;, effectively serving as coordinates in the &lt;a href=&quot;https://en.wikipedia.org/wiki/RGB_color_spaces&quot;&gt;RGB color space&lt;/a&gt;. Changing their proportions can be loosely compared to mixing paints to achieve a desired hue.&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; Strictly speaking, the RGB color model is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Additive_color&quot;&gt;additive&lt;/a&gt; one, meaning it combines specific wavelengths of light to synthesize complex colors. In contrast, paint mixing follows a &lt;a href=&quot;https://en.wikipedia.org/wiki/Subtractive_color&quot;&gt;subtractive&lt;/a&gt; model, where pigments absorb certain wavelengths of light from the visible spectrum.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To reveal the pixel’s primary colors as decimal numbers, you can open the &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;Python REPL&lt;/a&gt; and define &lt;strong&gt;binary literals&lt;/strong&gt; by prefixing the corresponding bit sequences with &lt;code&gt;0b&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;mb&quot;&gt;0b00110000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mb&quot;&gt;0b10001100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mb&quot;&gt;0b11001001&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(48, 140, 201)&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Binary literals are an alternative way of defining integers in Python. Other types of numeric literals include hexadecimal and octal. For example, you can represent the integer &lt;code&gt;48&lt;/code&gt; as &lt;code&gt;0x30&lt;/code&gt; in hexadecimal or &lt;code&gt;0o60&lt;/code&gt; in octal, allowing you to write the same number differently.&lt;/p&gt;
&lt;p&gt;Having such flexibility comes in handy since it’s customary to express byte values using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hexadecimal&quot;&gt;hexadecimal numeral system&lt;/a&gt;. By rewriting each byte as a &lt;strong&gt;two-digit hex number&lt;/strong&gt;, you can represent your pixel color much more compactly compared to the equivalent binary sequence:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;nb&quot;&gt;hex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;48&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;hex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;140&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;hex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;201&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(&#x27;0x30&#x27;, &#x27;0x8c&#x27;, &#x27;0xc9&#x27;)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;308cc9&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3181769&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;001100001000110011001001&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3181769&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Calling the built-in &lt;a href=&quot;/ref/builtin-functions/hex/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;hex()&lt;/code&gt;&lt;/a&gt; function on an integer returns the corresponding hexadecimal literal as a string. When you combine the resulting hex numbers, you’re able to describe a 24-bit color with just six digits (&lt;code&gt;308cc9&lt;/code&gt;). Go ahead and open an &lt;a href=&quot;https://www.google.com/search?q=color+picker&quot;&gt;online color picker&lt;/a&gt; to see what that encoded value looks like:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-bytes/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-bytes/ »&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 Polars</title>
      <id>https://realpython.com/courses/working-with-python-polars/</id>
      <link href="https://realpython.com/courses/working-with-python-polars/"/>
      <updated>2025-03-04T14:00:00+00:00</updated>
      <summary>Welcome to the world of Polars, a powerful DataFrame library for Python. In this video course, you&#x27;ll get a hands-on introduction to Polars&#x27; core features and see why this library is catching so much buzz.</summary>
      <content type="html">
        &lt;p&gt;In the world of data analysis and manipulation, Python has long been the go-to language. With extensive and user-friendly libraries like &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/learning-paths/pandas-data-science/&quot;&gt;pandas&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/pyspark-intro/&quot;&gt;PySpark&lt;/a&gt;, there&amp;rsquo;s a solution available for almost any data-driven task. Among these libraries, one name that&amp;rsquo;s been generating a significant amount of buzz lately is &lt;a href=&quot;https://pola-rs.github.io/polars-book/&quot;&gt;Polars&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Polars is a high-performance DataFrame library, designed to provide fast and efficient data processing capabilities. Inspired by the reigning pandas library, Polars takes things to another level, offering a seamless experience for working with large datasets that might not fit into memory.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why Polars is so &lt;strong&gt;performant&lt;/strong&gt; and attention-grabbing&lt;/li&gt;
&lt;li&gt;How to work with &lt;strong&gt;DataFrames&lt;/strong&gt;, &lt;strong&gt;expressions&lt;/strong&gt;, and &lt;strong&gt;contexts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;read&lt;/strong&gt; data into &lt;strong&gt;DataFrames&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;group&lt;/strong&gt; and &lt;strong&gt;aggregate&lt;/strong&gt; data &lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;lazy API&lt;/strong&gt; is and how to build &lt;strong&gt;lazy queries&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python while Loops: Repeating Tasks Conditionally</title>
      <id>https://realpython.com/python-while-loop/</id>
      <link href="https://realpython.com/python-while-loop/"/>
      <updated>2025-03-03T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about indefinite iteration using the Python while loop. You&#x27;ll be able to construct basic and complex while loops, interrupt loop execution with break and continue, use the else clause with a while loop, and deal with infinite loops.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;code&gt;while&lt;/code&gt; loop enables you to execute a block of code repeatedly as long as a given condition remains true. Unlike &lt;code&gt;for&lt;/code&gt; loops, which iterate a known number of times, &lt;code&gt;while&lt;/code&gt; loops are ideal for situations where the number of iterations isn’t known upfront.&lt;/p&gt;
&lt;p&gt;Loops are a pretty useful construct in Python, so learning how to write and use them is a great skill for you as a Python developer.&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;&lt;code&gt;while&lt;/code&gt; is a Python keyword&lt;/strong&gt; used to initiate a loop that repeats a block of code as long as a condition is true.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A &lt;code&gt;while&lt;/code&gt; loop works by evaluating a condition&lt;/strong&gt; at the start of each iteration. If the condition is true, then the loop executes. Otherwise, it terminates.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;while&lt;/code&gt; loops are useful when the number of iterations is unknown&lt;/strong&gt;, such as waiting for a condition to change or continuously processing user input.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;while True&lt;/code&gt; in Python creates an infinite loop&lt;/strong&gt; that continues until a &lt;code&gt;break&lt;/code&gt; statement or external interruption occurs.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python lacks a built-in do-while loop&lt;/strong&gt;, but you can emulate it using a &lt;code&gt;while True&lt;/code&gt; loop with a &lt;code&gt;break&lt;/code&gt; statement for conditional termination.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With this knowledge, you’re prepared to write effective &lt;code&gt;while&lt;/code&gt; loops in your Python programs, handling a wide range of iteration needs.&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-while-loop-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-while-loop-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 work with while loops 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.6eec2e95bede.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 while Loops: Repeating Tasks Conditionally” 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-while-loop/&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: #e5c6aa;&quot; alt=&quot;Python while Loops: Repeating Tasks Conditionally&quot; src=&quot;https://files.realpython.com/media/UPDATE-Python-while-Loops-Indefinite-Iteration_Watermarked.d6148cf4b4a3.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-Python-while-Loops-Indefinite-Iteration_Watermarked.d6148cf4b4a3.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/UPDATE-Python-while-Loops-Indefinite-Iteration_Watermarked.d6148cf4b4a3.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/UPDATE-Python-while-Loops-Indefinite-Iteration_Watermarked.d6148cf4b4a3.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/UPDATE-Python-while-Loops-Indefinite-Iteration_Watermarked.d6148cf4b4a3.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.6eec2e95bede.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-while-loop/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python while Loops: Repeating Tasks Conditionally&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 Python&#x27;s while loop. This loop allows you to execute a block of code repeatedly as long as a given condition remains true. Understanding how to use while loops effectively is a crucial skill for any Python developer.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-python-while-loops&quot;&gt;Getting Started With Python &lt;code&gt;while&lt;/code&gt; Loops&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-python-while-loops&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In programming, loops are &lt;a href=&quot;/ref/glossary/control-flow/&quot; class=&quot;ref-link&quot;&gt;control flow&lt;/a&gt; statements that allow you to repeat a given set of operations a number of times. In practice, you’ll find two main types of loops:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/For_loop&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt; are mostly used to iterate a &lt;em&gt;known&lt;/em&gt; number of times, which is common when you’re processing data collections with a specific number of data items.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/While_loop&quot;&gt;&lt;code&gt;while&lt;/code&gt; loops&lt;/a&gt; are commonly used to iterate an &lt;em&gt;unknown&lt;/em&gt; number of times, which is useful when the number of iterations depends on a given condition.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Python has both of these loops and in this tutorial, you’ll learn about &lt;strong&gt;&lt;code&gt;while&lt;/code&gt; loops&lt;/strong&gt;. In Python, you’ll generally use &lt;code&gt;while&lt;/code&gt; loops when you need to repeat a series of tasks an unknown number of times.&lt;/p&gt;
&lt;p&gt;Python &lt;code&gt;while&lt;/code&gt; loops are &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html&quot;&gt;compound statements&lt;/a&gt; with a &lt;em&gt;header&lt;/em&gt; and a &lt;em&gt;code block&lt;/em&gt; that runs until a given condition becomes false. The basic syntax of a &lt;code&gt;while&lt;/code&gt; loop is shown below:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python_syntax&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python Syntax&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&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;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;condition&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;body&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this syntax, &lt;code&gt;condition&lt;/code&gt; is an &lt;a href=&quot;/ref/glossary/expression/&quot; class=&quot;ref-link&quot;&gt;expression&lt;/a&gt; that the loop evaluates for its truth value. If the condition is true, then the loop body runs. Otherwise, the loop terminates. Note that the loop body can consist of one or more statements that must be indented properly.&lt;/p&gt;
&lt;p&gt;Here’s a more detailed breakdown of this syntax:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;while&lt;/code&gt;&lt;/strong&gt; is the keyword that initiates the loop header.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;condition&lt;/code&gt;&lt;/strong&gt; is an expression evaluated for truthiness that defines the exit condition.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/strong&gt; consists of one or more statements to execute in each iteration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here’s a quick example of how you can use a &lt;code&gt;while&lt;/code&gt; loop to iterate over a decreasing sequence of numbers:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, &lt;code&gt;number &amp;gt; 0&lt;/code&gt; is the loop condition. If this condition returns a false value, the loop terminates. The body consists of a call to &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt; that displays the value on the screen. Next, you decrease the value of &lt;code&gt;number&lt;/code&gt;. This change will produce a different result when the loop evaluates the condition in the next iteration.&lt;/p&gt;
&lt;p&gt;The loop runs while the condition remains true. When the condition turns false, the loop terminates, and the program execution proceeds to the first statement after the loop body. In this example, the loop terminates when &lt;code&gt;number&lt;/code&gt; reaches a value less than or equal to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If the loop condition doesn’t become false, then you have a potentially infinite loop. Consider the following loop, and keep your fingers near the &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-control&quot;&gt;Ctrl&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-c&quot;&gt;C&lt;/kbd&gt;&lt;/span&gt; key combination to terminate its execution:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&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;n&quot;&gt;number&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;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&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;n&quot;&gt;number&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;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-5&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-7&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-9&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-11&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;KeyboardInterrupt&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, the loop condition is &lt;code&gt;number != 0&lt;/code&gt;. This condition works when you decrease &lt;code&gt;number&lt;/code&gt; by &lt;code&gt;1&lt;/code&gt;. However, if you decrease it by 2, the condition may never become false, resulting in a potentially infinite loop. In such cases, you can usually terminate the loop by pressing &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-control&quot;&gt;Ctrl&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-c&quot;&gt;C&lt;/kbd&gt;&lt;/span&gt;, which raises a &lt;span data-invalid-ref=&quot;builtin-exceptions/keyboardinterrupt&quot;&gt;&lt;code&gt;KeyboardInterrupt&lt;/code&gt;&lt;/span&gt; exception on most operating systems.&lt;/p&gt;
&lt;p&gt;Note that the &lt;code&gt;while&lt;/code&gt; loop checks its condition first before anything else happens. If it’s false to start with, then the loop body will never run:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-while-loop/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-while-loop/ »&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 #241: Deciphering Python Jargon &amp; Compiling Python 1.0</title>
      <id>https://realpython.com/podcasts/rpp/241/</id>
      <link href="https://realpython.com/podcasts/rpp/241/"/>
      <updated>2025-02-28T12:00:00+00:00</updated>
      <summary>How do you learn the terms commonly used when speaking about Python? How is the jargon similar to other programming languages? 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 do you learn the terms commonly used when speaking about Python? How is the jargon similar to other programming languages? 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 Work With Polars LazyFrames</title>
      <id>https://realpython.com/polars-lazyframe/</id>
      <link href="https://realpython.com/polars-lazyframe/"/>
      <updated>2025-02-26T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll gain an understanding of the principles behind Polars LazyFrames. You&#x27;ll also learn why using LazyFrames is often the preferred option over more traditional DataFrames.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;A Polars LazyFrame provides an efficient way to handle large datasets through lazy evaluation. Unlike traditional DataFrames, LazyFrames don’t contain data but instead store a set of instructions known as a query plan. &lt;strong&gt;Query plans&lt;/strong&gt; perform operations like predicate and projection pushdown, ensuring only necessary rows and columns are processed. LazyFrames also support the parallel execution of query plans, further enhancing performance.&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;A Polars LazyFrame allows &lt;strong&gt;efficient data processing&lt;/strong&gt; by storing query instructions instead of data.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lazy evaluation&lt;/strong&gt; in LazyFrames optimizes query plans before data materialization.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Predicate and projection pushdown&lt;/strong&gt; minimize unnecessary data processing in LazyFrames.&lt;/li&gt;
&lt;li&gt;You create a LazyFrame using functions like &lt;strong&gt;&lt;code&gt;scan_parquet()&lt;/code&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;code&gt;scan_csv()&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Switching between lazy and eager modes&lt;/strong&gt; is sometimes necessary for certain operations.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Dive into this tutorial to discover how LazyFrames can transform your data processing tasks, providing both efficiency and flexibility for managing large datasets.&lt;/p&gt;
&lt;p&gt;Before you start your learning journey, you should already be comfortable with the basics of working with DataFrames. This could be from any previous &lt;a href=&quot;https://docs.pola.rs/user-guide/concepts/data-types-and-structures/#dataframe&quot;&gt;Polars&lt;/a&gt; experience you have, or from using any other DataFrame library, such as &lt;a href=&quot;https://realpython.com/pandas-dataframe/&quot;&gt;pandas&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In addition, you may consider using &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter Notebook&lt;/a&gt; as you work through many of the examples in this tutorial. Alternatively, &lt;a href=&quot;https://realpython.com/using-jupyterlab/&quot;&gt;JupyterLab&lt;/a&gt; will enhance your notebook experience, but any Python environment you’re comfortable with will be fine.&lt;/p&gt;
&lt;p&gt;To get started, you’ll need some data. For the main part of this tutorial, you’ll use the &lt;code&gt;rides.parquet&lt;/code&gt; file included in the downloadable materials. You can download this 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/polars-lazyframe-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-polars-lazyframe-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 work with Polars LazyFrames.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;rides.parquet&lt;/code&gt; file is a doctored version of the taxi ride data freely available on the &lt;a href=&quot;https://www.nyc.gov/site/tlc/about/tlc-trip-record-data.page&quot;&gt;New York City Taxi and Limousine Commission (TLC)&lt;/a&gt; website. The dataset contains edited information about New York taxi cab rides from July 2024. Before you go any further, you’ll need to download the file and place it in your project folder.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;a href=&quot;https://en.wikipedia.org/wiki/Apache_Parquet&quot;&gt;Parquet format&lt;/a&gt; is a format for storing large volumes of data efficiently. Parquet files use compression to minimize storage space. They also maintain metadata about each column allowing columns to be searched efficiently, often in parallel, and without the need to read the entire file. Because this metadata is useful to LazyFrames when they need to investigate a file’s content, Parquet is an excellent format for LazyFrames to use.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The table below shows details of the &lt;code&gt;rides.parquet&lt;/code&gt; file’s columns, along with their &lt;a href=&quot;https://docs.pola.rs/user-guide/concepts/data-types-and-structures/#appendix-full-data-types-table&quot;&gt;Polars data types&lt;/a&gt;. The text in parentheses beside each data type shows how these types are annotated in a DataFrame header when Polars displays its results:&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;Column Name&lt;/th&gt;
&lt;th&gt;Polars Data Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pick_up&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;String (str)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pick-up borough&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;drop_off&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;String (str)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Drop-off borough&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;passengers&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Int32 (i32)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Number of passengers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;distance&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Int32 (i32)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Trip distance (miles)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;fare&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Int32 (i32)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Total fare ($)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;As a starting point, you’ll create a LazyFrame and take a first look at its data. To use Polars, you first need to install the Polars library into your Python environment. You might also like to install Matplotlib as well.  You’ll use this to view the inner workings of a LazyFrame graphically later on. To install both from a command prompt you use:&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.6eec2e95bede.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.6eec2e95bede.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.6eec2e95bede.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;p&gt;In a Windows environment use:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;polars&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;matplotlib&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Both libraries will install.&lt;/p&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;p&gt;In a Linux or macOS environment use:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;polars&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;matplotlib
&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Both libraries will install.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In a Jupyter Notebook, the command is &lt;code&gt;!python -m pip install polars matplotlib&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can then begin to use the Polars library and all of its cool features. Here’s what your data looks like, and here’s how to create your first LazyFrame:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&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 d-flex justify-content-between 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.6eec2e95bede.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 style=&quot;position: relative;&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;polars&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;pl&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;rides&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scan_parquet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;rides.parquet&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;rides&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;collect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;shape: (3_076_903, 5)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;┌───────────┬───────────┬────────────┬──────────┬──────┐&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ pick_up   ┆ drop_off  ┆ passengers ┆ distance ┆ fare │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ ---       ┆ ---       ┆ ---        ┆ ---      ┆ ---  │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ str       ┆ str       ┆ i32        ┆ i32      ┆ i32  │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;╞═══════════╪═══════════╪════════════╪══════════╪══════╡&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Manhattan ┆ Manhattan ┆ 1          ┆ 3        ┆ 24   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Queens    ┆ Manhattan ┆ 1          ┆ 19       ┆ 75   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Manhattan ┆ Queens    ┆ 1          ┆ 1        ┆ 16   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Queens    ┆ Manhattan ┆ 0          ┆ 9        ┆ 60   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Queens    ┆ Manhattan ┆ 1          ┆ 17       ┆ 90   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ …         ┆ …         ┆ …          ┆ …        ┆ …    │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Manhattan ┆ Manhattan ┆ null       ┆ 5        ┆ 27   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Manhattan ┆ Manhattan ┆ null       ┆ 4        ┆ 26   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Queens    ┆ Brooklyn  ┆ null       ┆ 4        ┆ 26   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Manhattan ┆ Manhattan ┆ null       ┆ 3        ┆ 24   │&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;│ Manhattan ┆ Manhattan ┆ null       ┆ 8        ┆ 35   │&lt;/span&gt;
&lt;span class=&quot;go&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;First of all, you import the Polars library using the conventional &lt;code&gt;pl&lt;/code&gt; alias. You then use the &lt;code&gt;scan_parquet()&lt;/code&gt; function to read &lt;code&gt;rides.parquet&lt;/code&gt;. This makes your LazyFrame aware of the data file’s content. A LazyFrame doesn’t contain data but instead contains a set of instructions detailing what processing is to be carried out. To access the data, you need to &lt;strong&gt;materialize&lt;/strong&gt; your LazyFrame by calling its &lt;code&gt;.collect()&lt;/code&gt; method. This creates a DataFrame and reads the data.&lt;/p&gt;
&lt;p&gt;In this example, &lt;code&gt;.collect()&lt;/code&gt; shows there are 3,076,903 rows and five columns of data, as indicated by its &lt;code&gt;shape&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Using LazyFrames may seem like a strange way of working given that you have to materialize them into &lt;a href=&quot;https://docs.pola.rs/api/python/stable/reference/dataframe/index.html&quot;&gt;DataFrames&lt;/a&gt; to view the data. You might wonder why not just stick with DataFrames instead. As you’ll see later, despite their name, LazyFrames offer an extremely efficient way to work with data. With their &lt;a href=&quot;https://docs.pola.rs/user-guide/lazy/&quot;&gt;lazy evaluation&lt;/a&gt; capabilities, LazyFrames should be your preferred way to work with data in Polars whenever possible.&lt;/p&gt;
&lt;p&gt;Next, you’ll learn the main ways you can create LazyFrames.&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.6eec2e95bede.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 Work With Polars LazyFrames” 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/polars-lazyframe/&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 Work With Polars LazyFrames&quot; src=&quot;https://files.realpython.com/media/How-to-Work-with-Polars-LazyFrame_Watermarked.4a66e20e0eaf.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-Work-with-Polars-LazyFrame_Watermarked.4a66e20e0eaf.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/How-to-Work-with-Polars-LazyFrame_Watermarked.4a66e20e0eaf.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/How-to-Work-with-Polars-LazyFrame_Watermarked.4a66e20e0eaf.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/How-to-Work-with-Polars-LazyFrame_Watermarked.4a66e20e0eaf.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.6eec2e95bede.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/polars-lazyframe/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;How to Work With Polars LazyFrames&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;This quiz will challenge your knowledge of working with Polars LazyFrames. You won&#x27;t find all the answers in the tutorial, so you&#x27;ll need to do some extra investigating. By finding all the answers, you&#x27;re sure to learn some interesting things along the way.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;how-to-create-a-polars-lazyframe&quot;&gt;How to Create a Polars LazyFrame&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-create-a-polars-lazyframe&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can create LazyFrames in three main ways:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/polars-lazyframe/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/polars-lazyframe/ »&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>Single and Double Underscore Naming Conventions in Python</title>
      <id>https://realpython.com/courses/single-double-underscore-naming-conventions/</id>
      <link href="https://realpython.com/courses/single-double-underscore-naming-conventions/"/>
      <updated>2025-02-25T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn a few Python naming conventions involving single and double underscores (_). You&#x27;ll learn how to use this character to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.</summary>
      <content type="html">
        &lt;p&gt;Python has a few important &lt;strong&gt;naming conventions&lt;/strong&gt; that are based on using either a single or double &lt;strong&gt;underscore&lt;/strong&gt; character (&lt;code&gt;_&lt;/code&gt;). These conventions allow you to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.&lt;/p&gt;
&lt;p&gt;Following and respecting these conventions allows you to write code that looks Pythonic and consistent in the eyes of other Python developers. This skill is especially useful when you&amp;rsquo;re writing code that&amp;rsquo;s intended for other developers to work with.&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 about Python &lt;strong&gt;naming conventions&lt;/strong&gt; that rely on using &lt;strong&gt;underscores&lt;/strong&gt; (&lt;code&gt;_&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Differentiate &lt;strong&gt;public&lt;/strong&gt; and &lt;strong&gt;non-public&lt;/strong&gt; names by using a single leading underscore&lt;/li&gt;
&lt;li&gt;Use double leading underscores to leverage &lt;strong&gt;name mangling&lt;/strong&gt; in Python classes&lt;/li&gt;
&lt;li&gt;Explore other &lt;strong&gt;common uses&lt;/strong&gt; of underscores in Python names&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 #240: Telling Effective Stories With Your Python Visualizations</title>
      <id>https://realpython.com/podcasts/rpp/240/</id>
      <link href="https://realpython.com/podcasts/rpp/240/"/>
      <updated>2025-02-21T12:00:00+00:00</updated>
      <summary>How do you make compelling visualizations that best convey the story of your data? What methods can you employ within popular Python tools to improve your plots and graphs? This week on the show, Matt Harrison returns to discuss his new book &quot;Effective Visualization: Exploiting Matplotlib &amp; Pandas.&quot;</summary>
      <content type="html">
        &lt;p&gt;How do you make compelling visualizations that best convey the story of your data? What methods can you employ within popular Python tools to improve your plots and graphs? This week on the show, Matt Harrison returns to discuss his new book &quot;Effective Visualization: Exploiting Matplotlib &amp; Pandas.&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Concatenating Strings in Python Efficiently</title>
      <id>https://realpython.com/courses/concatenating-strings-efficiently/</id>
      <link href="https://realpython.com/courses/concatenating-strings-efficiently/"/>
      <updated>2025-02-18T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to concatenate strings in Python. You&#x27;ll use different tools and techniques for string concatenation, including the concatenation operators and the .join() method. You&#x27;ll also explore other tools that can also be handy for string concatenation in Python.</summary>
      <content type="html">
        &lt;p&gt;Python &lt;strong&gt;string concatenation&lt;/strong&gt; is a fundamental operation that combines multiple strings into a single string. In Python, you can concatenate strings using the &lt;code&gt;+&lt;/code&gt; operator or append them with &lt;code&gt;+=&lt;/code&gt;. For more efficient concatenation, especially when working with lists of strings, the &lt;code&gt;.join()&lt;/code&gt; method is recommended. Other techniques include using &lt;code&gt;StringIO&lt;/code&gt; for large datasets and the &lt;code&gt;print()&lt;/code&gt; function for quick screen output.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand that you can:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Concatenate strings&lt;/strong&gt; in Python using the &lt;code&gt;+&lt;/code&gt; and &lt;code&gt;+=&lt;/code&gt; operators.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;+=&lt;/code&gt; to &lt;strong&gt;append a string&lt;/strong&gt; to an existing string.&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;.join()&lt;/code&gt; method to &lt;strong&gt;combine strings in a list&lt;/strong&gt; in Python.&lt;/li&gt;
&lt;li&gt;Handle a &lt;strong&gt;stream of strings&lt;/strong&gt; efficiently by using &lt;code&gt;StringIO&lt;/code&gt; as a container with a file-like interface.&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 #239: Behavior-Driven vs Test-Driven Development &amp; Using Regex in Python</title>
      <id>https://realpython.com/podcasts/rpp/239/</id>
      <link href="https://realpython.com/podcasts/rpp/239/"/>
      <updated>2025-02-14T12:00:00+00:00</updated>
      <summary>What is behavior-driven development, and how does it work alongside test-driven development? How do you communicate requirements between teams in an organization? 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 behavior-driven development, and how does it work alongside test-driven development? How do you communicate requirements between teams in an organization? 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>Building a Python Command-Line To-Do App With Typer</title>
      <id>https://realpython.com/courses/build-command-line-todo-app-typer/</id>
      <link href="https://realpython.com/courses/build-command-line-todo-app-typer/"/>
      <updated>2025-02-11T14:00:00+00:00</updated>
      <summary>In this step-by-step video course, you&#x27;ll create a to-do application for your command line using Python and Typer. While you build this app, you&#x27;ll learn the basics of Typer, a modern and versatile library for building command-line interfaces (CLI).</summary>
      <content type="html">
        &lt;p&gt;Building an application to manage your &lt;strong&gt;to-do list&lt;/strong&gt; can be an interesting project when you&amp;rsquo;re learning a new programming language or trying to take your skills to the next level. In this video course, you&amp;rsquo;ll build a functional to-do application for the command line using Python and &lt;a href=&quot;https://typer.tiangolo.com/&quot;&gt;Typer&lt;/a&gt;, which is a relatively young library for creating powerful command-line interface (CLI) applications in almost no time.&lt;/p&gt;
&lt;p&gt;With a project like this, you&amp;rsquo;ll apply a wide set of core programming skills while building a real-world application with real features and requirements.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Build a functional &lt;strong&gt;to-do application&lt;/strong&gt; with a &lt;strong&gt;Typer CLI&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Use Typer to add &lt;strong&gt;commands&lt;/strong&gt;, &lt;strong&gt;arguments&lt;/strong&gt;, and &lt;strong&gt;options&lt;/strong&gt; to your to-do app&lt;/li&gt;
&lt;li&gt;Test your Python to-do application with Typer&amp;rsquo;s &lt;strong&gt;&lt;code&gt;CliRunner&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;pytest&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;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 #238: Charlie Marsh: Accelerating Python Tooling With Ruff and uv</title>
      <id>https://realpython.com/podcasts/rpp/238/</id>
      <link href="https://realpython.com/podcasts/rpp/238/"/>
      <updated>2025-02-07T12:00:00+00:00</updated>
      <summary>Are you looking for fast tools to lint your code and manage your projects? How is the Rust programming language being used to speed up Python tools? This week on the show, we speak with Charlie Marsh about his company, Astral, and their tools, uv and Ruff.</summary>
      <content type="html">
        &lt;p&gt;Are you looking for fast tools to lint your code and manage your projects? How is the Rust programming language being used to speed up Python tools? This week on the show, we speak with Charlie Marsh about his company, Astral, and their tools, uv and Ruff.&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>NumPy Techniques and Practical Examples</title>
      <id>https://realpython.com/courses/numpy-techniques-practical-examples/</id>
      <link href="https://realpython.com/courses/numpy-techniques-practical-examples/"/>
      <updated>2025-02-04T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use NumPy by exploring several interesting examples. You&#x27;ll read data from a file into an array and analyze structured arrays to perform a reconciliation. You&#x27;ll also learn how to quickly chart an analysis and turn a custom function into a vectorized function.</summary>
      <content type="html">
        &lt;p&gt;The &lt;a href=&quot;https://numpy.org/doc/stable/reference/index.html#python-api&quot;&gt;NumPy library&lt;/a&gt; is a Python library used for scientific computing. It provides you with a multidimensional array object for storing and analyzing data in a wide variety of ways. In this video course, you&amp;rsquo;ll see examples of some features NumPy provides that aren&amp;rsquo;t always highlighted in other tutorials. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;strong&gt;multidimensional arrays&lt;/strong&gt; from data stored in files&lt;/li&gt;
&lt;li&gt;Identify and remove &lt;strong&gt;duplicate data&lt;/strong&gt; from a NumPy array&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;structured NumPy arrays&lt;/strong&gt; to reconcile the differences between datasets&lt;/li&gt;
&lt;li&gt;Analyze and chart specific parts of &lt;strong&gt;hierarchical&lt;/strong&gt; data&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;vectorized&lt;/strong&gt; versions of your own functions&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 #237: Testing Your Python Code Base: Unit vs. Integration</title>
      <id>https://realpython.com/podcasts/rpp/237/</id>
      <link href="https://realpython.com/podcasts/rpp/237/"/>
      <updated>2025-01-31T12:00:00+00:00</updated>
      <summary>What goes into creating automated tests for your Python code? Should you focus on testing the individual code sections or on how the entire system runs? 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 goes into creating automated tests for your Python code? Should you focus on testing the individual code sections or on how the entire system runs? 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>Creating a Scalable Flask Web Application From Scratch</title>
      <id>https://realpython.com/courses/create-scalable-flask-web-app/</id>
      <link href="https://realpython.com/courses/create-scalable-flask-web-app/"/>
      <updated>2025-01-28T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll explore the process of creating a boilerplate for a Flask web project. It&#x27;s a great starting point for any scalable Flask web app that you wish to develop in the future, from basic web pages to complex web applications.</summary>
      <content type="html">
        &lt;p&gt;Flask is a powerful and flexible micro web framework for Python, ideal for both small and large web projects. It provides a straightforward way to get a web application up and running, with all the features that you need to get started.&lt;/p&gt;
&lt;p&gt;Over the course of this video course, you&amp;rsquo;ll explore the process of creating a boilerplate for a Flask web project. This boilerplate will serve as a great starting point for any scalable Flask web app that you wish to develop in the future, from basic web pages to complex web applications.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up a &lt;strong&gt;Flask project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create a &lt;code&gt;&quot;Hello, World!&quot;&lt;/code&gt; &lt;strong&gt;Flask app&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;multiple pages&lt;/strong&gt; with blueprints&lt;/li&gt;
&lt;li&gt;Leverage &lt;strong&gt;Jinja templates&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Store &lt;strong&gt;static files&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #236: Simon Willison: Using LLMs for Python Development</title>
      <id>https://realpython.com/podcasts/rpp/236/</id>
      <link href="https://realpython.com/podcasts/rpp/236/"/>
      <updated>2025-01-24T12:00:00+00:00</updated>
      <summary>What are the current large language model (LLM) tools you can use to develop Python? What prompting techniques and strategies produce better results? This week on the show, we speak with Simon Willison about his LLM research and his exploration of writing Python code with these rapidly evolving tools.</summary>
      <content type="html">
        &lt;p&gt;What are the current large language model (LLM) tools you can use to develop Python? What prompting techniques and strategies produce better results? This week on the show, we speak with Simon Willison about his LLM research and his exploration of writing Python code with these rapidly evolving tools.&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&#x27;s tuple Data Type With Examples</title>
      <id>https://realpython.com/courses/exploring-tuple-data-type-examples/</id>
      <link href="https://realpython.com/courses/exploring-tuple-data-type-examples/"/>
      <updated>2025-01-21T14:00:00+00:00</updated>
      <summary>In Python, a tuple is a built-in data type that allows you to create immutable sequences of values. The values or items in a tuple can be of any type. This makes tuples pretty useful in those situations where you need to store heterogeneous data, like that in a database record, for example.</summary>
      <content type="html">
        &lt;p&gt;In Python, a &lt;strong&gt;&lt;code&gt;tuple&lt;/code&gt;&lt;/strong&gt; is a built-in data type that allows you to create &lt;strong&gt;immutable sequences&lt;/strong&gt; of values. The values or items in a tuple can be of any type. This makes tuples pretty useful in those situations where you need to store heterogeneous data, like that in a database record, for example.&lt;/p&gt;
&lt;p&gt;Through this tutorial, you&amp;rsquo;ll dive deep into Python tuples and get a solid understanding of their key features and use cases. This knowledge will allow you to write more efficient and reliable code by taking advantage of tuples.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; tuples in Python&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Access&lt;/strong&gt; the items in an existing tuple&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unpack&lt;/strong&gt;, &lt;strong&gt;return&lt;/strong&gt;, &lt;strong&gt;copy&lt;/strong&gt;, and &lt;strong&gt;concatenate&lt;/strong&gt; tuples&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reverse&lt;/strong&gt;, &lt;strong&gt;sort&lt;/strong&gt;, and &lt;strong&gt;traverse&lt;/strong&gt; existing tuples&lt;/li&gt;
&lt;li&gt;Explore other &lt;strong&gt;features&lt;/strong&gt; and common &lt;strong&gt;gotchas&lt;/strong&gt; of tuples&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 #235: Principles for Considering Your Python Tooling</title>
      <id>https://realpython.com/podcasts/rpp/235/</id>
      <link href="https://realpython.com/podcasts/rpp/235/"/>
      <updated>2025-01-17T12:00:00+00:00</updated>
      <summary>What are the principles you should consider when making decisions about which Python tools to use? What anti-patterns get in the way of making the right choices for your team? 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 the principles you should consider when making decisions about which Python tools to use? What anti-patterns get in the way of making the right choices for your team? 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>
  

</feed>
