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

  
    <entry>
      <title>Python&#x27;s raise: Effectively Raising Exceptions in Your Code</title>
      <id>https://realpython.com/python-raise-exception/</id>
      <link href="https://realpython.com/python-raise-exception/"/>
      <updated>2023-06-19T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to raise exceptions in Python, which will improve your ability to efficiently handle errors and exceptional situations in your code. This way, you&#x27;ll write more reliable, robust, and maintainable code.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In your Python journey, you’ll come across situations where you need to signal that something is going wrong in your code. For example, maybe a file doesn’t exist, a network or database connection fails, or your code gets invalid input. A common approach to tackle these issues is to &lt;strong&gt;raise an exception&lt;/strong&gt;, notifying the user that an error has occurred. That’s what Python’s &lt;code&gt;raise&lt;/code&gt; statement is for.&lt;/p&gt;
&lt;p&gt;Learning about the &lt;code&gt;raise&lt;/code&gt; statement allows you to effectively handle errors and exceptional situations in your code. This way, you’ll develop more robust programs and higher-quality code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Raise exceptions in Python using the &lt;strong&gt;&lt;code&gt;raise&lt;/code&gt;&lt;/strong&gt; statement&lt;/li&gt;
&lt;li&gt;Decide &lt;strong&gt;which exceptions&lt;/strong&gt; to raise and &lt;strong&gt;when&lt;/strong&gt; to raise them in your code&lt;/li&gt;
&lt;li&gt;Explore common &lt;strong&gt;use cases&lt;/strong&gt; for raising exceptions in Python&lt;/li&gt;
&lt;li&gt;Apply &lt;strong&gt;best practices&lt;/strong&gt; for raising exceptions in your Python code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should understand the fundamentals of Python, including &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;data types&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional&lt;/a&gt; statements, &lt;a href=&quot;https://realpython.com/python-exceptions/&quot;&gt;exception&lt;/a&gt; handling, and &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-raise-exception-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-raise-exception-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that you’ll use to gracefully raise and handle exceptions in your Python code.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;handling-exceptional-situations-in-python&quot;&gt;Handling Exceptional Situations in Python&lt;a class=&quot;headerlink&quot; href=&quot;#handling-exceptional-situations-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/python-exceptions/&quot;&gt;Exceptions&lt;/a&gt; play a fundamental role in Python. They allow you to handle &lt;strong&gt;errors&lt;/strong&gt; and &lt;strong&gt;exceptional situations&lt;/strong&gt; in your code. But what is an exception? An exception represents an error or indicates that something is going wrong. Some programming languages, such as &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C&lt;/a&gt;, and &lt;a href=&quot;https://go.dev/&quot;&gt;Go&lt;/a&gt;, encourage you to return error codes, which you &lt;em&gt;check&lt;/em&gt;. In contrast, Python encourages you to raise exceptions, which you &lt;em&gt;handle&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; In Python, not all exceptions are errors. The built-in &lt;a href=&quot;https://docs.python.org/3/library/exceptions.html#StopIteration&quot;&gt;&lt;code&gt;StopIteration&lt;/code&gt;&lt;/a&gt; exception is an excellent example of this. Python internally uses this exception to terminate the iteration over &lt;a href=&quot;https://realpython.com/python-iterators-iterables/&quot;&gt;iterators&lt;/a&gt;. Python exceptions that represent errors have the &lt;code&gt;Error&lt;/code&gt; suffix attached to their names.&lt;/p&gt;
&lt;p&gt;Python also has a specific category of exceptions that represent &lt;a href=&quot;https://docs.python.org/3/library/exceptions.html#warnings&quot;&gt;warnings&lt;/a&gt; to the programmer. Warnings come in handy when you need to alert the user of some condition in a program. However, that condition may not warrant raising an exception and terminating the program. A common example of a warning is &lt;a href=&quot;https://docs.python.org/3/library/exceptions.html#DeprecationWarning&quot;&gt;&lt;code&gt;DeprecationWarning&lt;/code&gt;&lt;/a&gt;, which appears when you use deprecated features.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;When a problem occurs in a program, Python automatically raises an exception. For example, watch what happens if you try to access a nonexistent index in a &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;&lt;code&gt;list&lt;/code&gt;&lt;/a&gt; object:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;colors&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;red&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;orange&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;yellow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;green&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;indigo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;violet&quot;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;colors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;IndexError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;list index out of range&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, your &lt;code&gt;colors&lt;/code&gt; list doesn’t have a &lt;code&gt;10&lt;/code&gt; index. Its indices go from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;6&lt;/code&gt;, covering your seven colors. So, if you try to get index number &lt;code&gt;10&lt;/code&gt;, then you get an &lt;a href=&quot;https://realpython.com/python-traceback/#indexerror&quot;&gt;&lt;code&gt;IndexError&lt;/code&gt;&lt;/a&gt; exception telling you that your target index is out of range.&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; In the example above, Python raised the exception on its own, which it’ll only do with &lt;a href=&quot;#raising-built-in-exceptions&quot;&gt;built-in exceptions&lt;/a&gt;. You, as a programmer, have the option to raise built-in or custom exceptions, as you’ll learn in the section &lt;a href=&quot;#choosing-the-exception-to-raise-built-in-vs-custom&quot;&gt;Choosing the Exception to Raise: Built-in vs Custom&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Every raised exception has a &lt;a href=&quot;https://realpython.com/python-traceback/&quot;&gt;traceback&lt;/a&gt;, also known as a &lt;strong&gt;stack trace&lt;/strong&gt;, &lt;strong&gt;stack traceback&lt;/strong&gt;, or &lt;strong&gt;backtrace&lt;/strong&gt;, among other names. A traceback is a report containing the sequence of calls and operations that traces down to the current exception.&lt;/p&gt;
&lt;p&gt;In Python, the traceback header is &lt;code&gt;Traceback (most recent call last)&lt;/code&gt; in most situations. Then you’ll have the actual call stack and the exception name followed by its error message.&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; Since the introduction of the new &lt;a href=&quot;https://realpython.com/python39-new-features/#a-more-powerful-python-parser&quot;&gt;PEG parser&lt;/a&gt; in Python &lt;a href=&quot;https://realpython.com/python39-new-features/&quot;&gt;3.9&lt;/a&gt;, there’s been an ongoing effort to make the &lt;a href=&quot;https://realpython.com/python311-error-messages/&quot;&gt;error messages&lt;/a&gt; in tracebacks more helpful and specific. This effort continues to produce new results, and Python 3.12 has incorporated &lt;a href=&quot;https://realpython.com/python312-error-messages/&quot;&gt;even better error messages&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Exceptions will cause your program to terminate unless you handle them using a &lt;a href=&quot;https://realpython.com/python-exceptions/#the-try-and-except-block-handling-exceptions&quot;&gt;&lt;code&gt;try&lt;/code&gt; … &lt;code&gt;except&lt;/code&gt;&lt;/a&gt; block:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;try&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;colors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;except&lt;/span&gt; &lt;span class=&quot;ne&quot;&gt;IndexError&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;s2&quot;&gt;&quot;Your list doesn&#x27;t have that index :-(&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Your list doesn&#x27;t have that index :-(&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first step in handling an exception is to &lt;em&gt;predict which exceptions can happen&lt;/em&gt;. If you don’t do that, then you can’t handle the exceptions, and your program will crash. In that situation, Python will print the exception traceback so that you can figure out how to fix the problem. Sometimes, you must let the program fail in order to discover the exceptions that it raises.&lt;/p&gt;
&lt;p&gt;In the above example, you know beforehand that indexing a list with an index beyond its range will raise an &lt;code&gt;IndexError&lt;/code&gt; exception. So, you’re ready to catch and handle that specific exception. The &lt;code&gt;try&lt;/code&gt; block takes care of catching exceptions. The &lt;code&gt;except&lt;/code&gt; clause specifies the exception that you’re predicting, and the &lt;code&gt;except&lt;/code&gt; code block allows you to take action accordingly. The whole process is known as &lt;strong&gt;exception handling&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If your code raises an exception in a function but doesn’t handle it there, then the exception propagates to where you called function. If your code doesn’t handle it there either, then it continues propagating until it reaches the main program. If there’s no exception handler there, then the program halts with an exception traceback.&lt;/p&gt;
&lt;p&gt;Exceptions are everywhere in Python. Virtually every module in the &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt; uses them. Python will raise exceptions in many different circumstances. The Python documentation states that:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Exceptions are a means of breaking out of the normal flow of control of a code block in order to handle errors or other exceptional conditions. An exception is &lt;em&gt;raised&lt;/em&gt; at the point where the error is detected; it may be &lt;em&gt;handled&lt;/em&gt; by the surrounding code block or by any code block that directly or indirectly invoked the code block where the error occurred. (&lt;a href=&quot;https://docs.python.org/3/reference/executionmodel.html#exceptions&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In short, Python automatically raises exceptions when an error occurs during a program’s execution. Python also allows you to raise exceptions on demand using the &lt;code&gt;raise&lt;/code&gt; keyword. This keyword lets you handle your program’s errors in a more controlled manner.&lt;/p&gt;
&lt;h2 id=&quot;raising-exceptions-in-python-the-raise-statement&quot;&gt;Raising Exceptions in Python: The &lt;code&gt;raise&lt;/code&gt; Statement&lt;a class=&quot;headerlink&quot; href=&quot;#raising-exceptions-in-python-the-raise-statement&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-raise-exception/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-raise-exception/ »&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 #160: Inheriting a Large Python Code Base &amp; Building a GUI With Kivy</title>
      <id>https://realpython.com/podcasts/rpp/160/</id>
      <link href="https://realpython.com/podcasts/rpp/160/"/>
      <updated>2023-06-16T12:00:00+00:00</updated>
      <summary>What are the unique challenges of a large Python code base? What techniques can you implement to simplify the management of a big project? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What are the unique challenges of a large Python code base? What techniques can you implement to simplify the management of a big project? This week on the show, Christopher Trudeau is here, 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 Make Engaging Programming Videos</title>
      <id>https://realpython.com/how-to-make-programming-videos/</id>
      <link href="https://realpython.com/how-to-make-programming-videos/"/>
      <updated>2023-06-14T14:00:00+00:00</updated>
      <summary>Creating a screencast can be a great way for you to to share your knowledge and help fellow developers on your team. However, not all video tutorials are equally effective. In this tutorial, you&#x27;ll learn how to make engaging and informative programming videos that will impress your peers.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://realpython.com/courses/&quot;&gt;Programming videos&lt;/a&gt; have become an increasingly popular medium for sharing knowledge and helping the fellow developers on your team. Especially when you’re working remotely, effective communication is vital, and screencasts have emerged as a powerful tool that meets this need. That’s why knowing how to make programming videos is a valuable skill, no matter where you are in your career.&lt;/p&gt;
&lt;p&gt;Even if you’ve never considered creating video content yourself, creating a screencast can be a great way to enhance written documentation or demonstrate complex processes as a professional programmer. Often, a two-minute video helps your colleagues more than a wordy email. Other times, an in-depth thirty-minute video is more convincing than an hour-long meeting.&lt;/p&gt;
&lt;p&gt;However, not all videos are equally effective. To create engaging and informative programming screencasts, you should keep some important details in mind.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Know when the &lt;strong&gt;video format&lt;/strong&gt; is the right choice&lt;/li&gt;
&lt;li&gt;Set up your machine to &lt;strong&gt;record screencasts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Prepare&lt;/strong&gt; the content and the code&lt;/li&gt;
&lt;li&gt;Be a captivating &lt;strong&gt;programming instructor&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Handle mistakes&lt;/strong&gt; while filming&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Export&lt;/strong&gt; and &lt;strong&gt;share&lt;/strong&gt; your video&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the end, you’ll be equipped with the knowledge and skills to produce screencasts that make a meaningful impact on your viewers.&lt;/p&gt;
&lt;p&gt;If you’re using VS Code and want to have a distraction-free environment in your code editor while recording, then you can download a handy settings file for VS Code 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;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/how-to-make-programming-videos-file/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-how-to-make-programming-videos-file&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the settings file&lt;/a&gt; that you can use to create a clean, readable VS Code editor for your programming video tutorials.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;decide-when-a-programming-video-makes-sense&quot;&gt;Decide When a Programming Video Makes Sense&lt;a class=&quot;headerlink&quot; href=&quot;#decide-when-a-programming-video-makes-sense&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Not every idea that you want to get across is worth recording a video for.
But the more experienced you are with hitting the record button, the more convenient it’ll be to use the video format instead of writing.&lt;/p&gt;
&lt;p&gt;There are three common tasks where a video can come in handy:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Showing off a new feature&lt;/li&gt;
&lt;li&gt;Asking for help with a bug&lt;/li&gt;
&lt;li&gt;Giving visual feedback on a program&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While your desired outcome for each of these use cases is probably different, the preparation for each of them is quite similar. 
In this section, you’ll explore how to tackle a process that applies to all the tasks so you know what you want to talk about in your recording.&lt;/p&gt;
&lt;h3 id=&quot;focus-on-the-outcome&quot;&gt;Focus on the Outcome&lt;a class=&quot;headerlink&quot; href=&quot;#focus-on-the-outcome&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you decide to create a programming video, then it’s important to focus on the outcome that you want to achieve. By clearly defining your desired outcome, you can structure your video in a way that effectively communicates the key points and ensures that your viewers gain the intended knowledge or understanding.&lt;/p&gt;
&lt;p&gt;When showcasing key features, your objective could be to demonstrate the core functionality of a &lt;a href=&quot;https://realpython.com/python-package-quality/&quot;&gt;high-quality Python package&lt;/a&gt; or a new framework that you’re trying out. In these cases, you may want to provide step-by-step instructions and examples to help viewers understand and use the package effectively on their machines.&lt;/p&gt;
&lt;p&gt;Other times, you may want to provide constructive feedback on the user interface of an application. For example, maybe you want to share your thoughts on the &lt;a href=&quot;https://realpython.com/flask-javascript-frontend-for-rest-api/&quot;&gt;front end of a Flask API&lt;/a&gt;. Then your objective could be to highlight potential improvements, usability concerns, and design recommendations.&lt;/p&gt;
&lt;p&gt;Another outcome of a screencast could be to guide viewers through the process of identifying a specific bug. This might include explaining the symptoms and potential causes then troubleshooting steps to narrow down and locate the issue effectively.&lt;/p&gt;
&lt;p&gt;Some people are often more inclined to watch a short video instead of taking the same time to read. So if you’re looking for help in an &lt;a href=&quot;https://realpython.com/community-slack-guide/&quot;&gt;online Python community&lt;/a&gt;, then a small screencast can be a great way to illustrate your problem. &lt;/p&gt;
&lt;h3 id=&quot;sketch-out-code-examples&quot;&gt;Sketch Out Code Examples&lt;a class=&quot;headerlink&quot; href=&quot;#sketch-out-code-examples&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Chances are that you’ll include some code in your programming videos. You may showcase snippets or perform live coding. Either way, it’s crucial to sketch out the code examples beforehand.&lt;/p&gt;
&lt;p&gt;Preparing code examples allows you to iterate how you want to present your code before you start filming. Here are some ideas of how you can sketch out your code examples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Plan the structure:&lt;/strong&gt; Outline the code examples in advance to determine their logical structure and flow. This helps present the code coherently, making it easier for your viewers to follow along and understand the concepts that you explain.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clarify your key points:&lt;/strong&gt; Refine and clarify the key points that you want to convey. Identify and highlight crucial aspects of the code, ensuring that you address essential concepts and techniques effectively.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ensure the code is correct:&lt;/strong&gt; Test the code snippets beforehand to verify their correctness. This ensures that they produce the desired output or functionality during the recording, allowing you to deliver &lt;a href=&quot;https://realpython.com/python-pep8/&quot;&gt;accurate and well-formatted Python code&lt;/a&gt; to your viewers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Optimize for presentation:&lt;/strong&gt; Optimize the code for presentation purposes by removing irrelevant segments, simplifying complex sections, or deleting unnecessary &lt;a href=&quot;https://realpython.com/python-type-checking/#annotations&quot;&gt;type annotations&lt;/a&gt;. This makes your Python code examples concise, focused, and readily comprehensible for your audience.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By preparing your code, you ensure that it’s clean, organized, and operational, resulting in a seamless and effective learning experience for your viewers.&lt;/p&gt;
&lt;h3 id=&quot;take-speaker-notes&quot;&gt;Take Speaker Notes&lt;a class=&quot;headerlink&quot; href=&quot;#take-speaker-notes&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/how-to-make-programming-videos/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/how-to-make-programming-videos/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics: Reading and Writing Files</title>
      <id>https://realpython.com/courses/python-reading-and-writing-files/</id>
      <link href="https://realpython.com/courses/python-reading-and-writing-files/"/>
      <updated>2023-06-13T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to move data back and forth between your Python programs and external software by reading and writing files. You&#x27;ll practice reading and writing data stored in the CSV file format, one of the most widely supported file formats for transferring tabular data.</summary>
      <content type="html">
        &lt;p&gt;Files are everywhere in the modern world. They&amp;rsquo;re the medium in which data is digitally stored and transferred. Chances are, you&amp;rsquo;ve opened dozens, if not hundreds, of files just today! Now it&amp;rsquo;s time to read and write files with Python.&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;Understand the difference between &lt;strong&gt;text&lt;/strong&gt; and &lt;strong&gt;binary&lt;/strong&gt; files&lt;/li&gt;
&lt;li&gt;Learn about &lt;strong&gt;character encodings&lt;/strong&gt; and &lt;strong&gt;line endings&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Work with &lt;strong&gt;file objects&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Read and write character data in various &lt;strong&gt;file modes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;open()&lt;/code&gt;, &lt;code&gt;Path.open()&lt;/code&gt;, and the &lt;code&gt;with&lt;/code&gt; statement&lt;/li&gt;
&lt;li&gt;Take advantage of the &lt;code&gt;csv&lt;/code&gt; module to manipulate &lt;strong&gt;CSV data&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out the other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course. If you&amp;rsquo;re just getting started, then you might want to check out &lt;a href=&quot;https://realpython.com/courses/setting-up-python/&quot;&gt;Python Basics: Setting Up Python&lt;/a&gt; before diving into this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python News: What&#x27;s New From May 2023</title>
      <id>https://realpython.com/python-news-may-2023/</id>
      <link href="https://realpython.com/python-news-may-2023/"/>
      <updated>2023-06-12T14:00:00+00:00</updated>
      <summary>May 2023 was an exciting month for Python developers. Python 3.12 is getting closer to its final release as it enters the beta stage. All presentations from PyCon US are available to everyone on video. And a new Python-based programming language is generating a lot of buzz.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;May 2023 was an important month for Python, as the upcoming &lt;strong&gt;Python 3.12 version&lt;/strong&gt; is now &lt;strong&gt;feature complete&lt;/strong&gt;. You can dig into a lot of information about Python and its development by reading the coverage of the &lt;strong&gt;Language Summit&lt;/strong&gt; and watching videos from &lt;strong&gt;PyCon US&lt;/strong&gt;. Modular has announced a &lt;strong&gt;new programming language&lt;/strong&gt; that’s based on Python.&lt;/p&gt;
&lt;p&gt;Grab a cup of your favorite beverage and sit down with the most important Python news from the last month. &lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Join Now:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-newsletter&quot; data-focus=&quot;false&quot;&gt;Click here to join the Real Python Newsletter&lt;/a&gt; and you&#x27;ll never miss another Python tutorial, course update, or post.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;python-312-in-beta&quot;&gt;Python 3.12 in Beta&lt;a class=&quot;headerlink&quot; href=&quot;#python-312-in-beta&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Since 2019, a new version of Python has been released every year in October. The next version of Python–Python 3.12—is no different. Its release is planned for &lt;a href=&quot;https://peps.python.org/pep-0693/&quot;&gt;October 2, 2023&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Python 3.12 reached an important milestone last month when its &lt;a href=&quot;https://www.python.org/downloads/release/python-3120b1/&quot;&gt;first beta version&lt;/a&gt; was released. A &lt;strong&gt;beta release&lt;/strong&gt; is an early release of an upcoming Python version. In contrast to &lt;strong&gt;alpha releases&lt;/strong&gt;, which have been available for a while, the betas are &lt;strong&gt;feature complete&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;Being feature complete means that there’ll be no features added to Python 3.12 that aren’t already in the beta version. Instead, the time until the final release in October will focus on finding and fixing bugs and other issues. The core developers ask for your help:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We strongly encourage maintainers of third-party Python projects to test with 3.12 during the beta phase and report issues found to &lt;a href=&quot;https://github.com/python/cpython/issues&quot;&gt;the Python bug tracker&lt;/a&gt; as soon as possible. (&lt;a href=&quot;https://www.python.org/downloads/release/python-3120b2/&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You should &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;install the beta version&lt;/a&gt; and test that your code still works. Finding bugs during the beta phase is an important and impactful way to &lt;a href=&quot;https://realpython.com/start-contributing-python/&quot;&gt;contribute to Python&lt;/a&gt;. If you maintain a package on &lt;a href=&quot;https://realpython.com/pypi-publish-python-package/&quot;&gt;PyPI&lt;/a&gt;, then you can help the community by running &lt;a href=&quot;https://realpython.com/pytest-python-testing/&quot;&gt;tests&lt;/a&gt; and publishing &lt;a href=&quot;https://realpython.com/python-wheels/&quot;&gt;wheels&lt;/a&gt; for Python 3.12.&lt;/p&gt;
&lt;p&gt;You can learn about all the upcoming features from &lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html&quot;&gt;What’s New in Python 3.12&lt;/a&gt;. Some highlights are the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python312-error-messages/&quot;&gt;Ever better error messages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;More powerful &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;f-strings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Better support for sub-interpreters&lt;/li&gt;
&lt;li&gt;Improved &lt;a href=&quot;https://realpython.com/python-type-checking/#static-typing&quot;&gt;static typing&lt;/a&gt; features&lt;/li&gt;
&lt;li&gt;Support for the Linux perf profiler&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition, the &lt;a href=&quot;https://github.com/faster-cpython/&quot;&gt;Faster CPython project&lt;/a&gt; continues to deliver performance improvements, and Python 3.12 will be even faster than &lt;a href=&quot;https://realpython.com/python311-new-features/&quot;&gt;Python 3.11&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-may-2023/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-may-2023/ »&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 #159: Volunteering, Organizing, and Finding a Python Community</title>
      <id>https://realpython.com/podcasts/rpp/159/</id>
      <link href="https://realpython.com/podcasts/rpp/159/"/>
      <updated>2023-06-09T12:00:00+00:00</updated>
      <summary>Have you thought about getting more involved in the Python community? Are you interested in volunteering for an event or becoming an organizer? This week on the show, we speak with organizers from this year&#x27;s PyCascades conference about making connections, learning new skills, and rationing your time.</summary>
      <content type="html">
        &lt;p&gt;Have you thought about getting more involved in the Python community? Are you interested in volunteering for an event or becoming an organizer? This week on the show, we speak with organizers from this year&#x27;s PyCascades conference about making connections, learning new skills, and rationing your time.&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>What&#x27;s the Zen of Python?</title>
      <id>https://realpython.com/zen-of-python/</id>
      <link href="https://realpython.com/zen-of-python/"/>
      <updated>2023-06-07T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll be exploring the Zen of Python, a collection of nineteen guiding principles for writing idiomatic Python. You&#x27;ll find out how they originated and whether you should follow them. Along the way, you&#x27;ll uncover several inside jokes associated with this humorous poem.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’ve been learning Python long enough, then you’ve likely seen or heard about the &lt;strong&gt;Zen of Python&lt;/strong&gt;. Experienced Pythonistas often refer to it as a source of wisdom and guidance, especially when they want to settle an argument about certain design decisions in a piece of code. Others take these principles even more seriously by considering them a sort of Pythonic &lt;a href=&quot;https://www.merriam-webster.com/dictionary/decalogue&quot;&gt;decalogue&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn where to find the Zen of Python, how it came into existence, and how to interpret its mysterious aphorisms. You don’t need to be a Python master to understand the Zen of Python! But you do need to answer an important question: &lt;strong&gt;What exactly is the Zen of Python?&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-easter-eggs/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-easter-eggs&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download your Easter egg hunt&lt;/a&gt; to discover what’s hidden inside Python!&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;in-short-its-a-humorous-poem-listing-python-philosophies&quot;&gt;In Short: It’s a Humorous Poem Listing Python Philosophies&lt;a class=&quot;headerlink&quot; href=&quot;#in-short-its-a-humorous-poem-listing-python-philosophies&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;According to the &lt;a href=&quot;https://docs.python.org/3/glossary.html&quot;&gt;Python glossary&lt;/a&gt;, which contains definitions of popular terms related to this programming language, the &lt;strong&gt;Zen of Python&lt;/strong&gt; is a:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Listing of Python design principles and philosophies that are helpful in understanding and using the language. The listing can be found by typing “&lt;code&gt;import this&lt;/code&gt;” at the interactive prompt. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-Zen-of-Python&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Indeed, when you type the indicated &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;&lt;code&gt;import&lt;/code&gt; statement&lt;/a&gt; into an interactive &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;Python REPL&lt;/a&gt;, then you’ll be presented with the nineteen aphorisms that make up the Zen of Python:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;this&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;The Zen of Python, by Tim Peters&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;Beautiful is better than ugly.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Explicit is better than implicit.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Simple is better than complex.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Complex is better than complicated.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Flat is better than nested.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Sparse is better than dense.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Readability counts.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Special cases aren&#x27;t special enough to break the rules.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Although practicality beats purity.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Errors should never pass silently.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Unless explicitly silenced.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;In the face of ambiguity, refuse the temptation to guess.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;There should be one-- and preferably only one --obvious way to do it.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Although that way may not be obvious at first unless you&#x27;re Dutch.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Now is better than never.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Although never is often better than *right* now.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;If the implementation is hard to explain, it&#x27;s a bad idea.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;If the implementation is easy to explain, it may be a good idea.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Namespaces are one honking great idea -- let&#x27;s do more of those!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The byline reveals the poem’s author, &lt;a href=&quot;https://en.wikipedia.org/wiki/Tim_Peters_(software_engineer)&quot;&gt;Tim Peters&lt;/a&gt;, who’s a renowned software engineer and a long-standing &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;CPython&lt;/a&gt; core developer best known for inventing the &lt;a href=&quot;https://realpython.com/sorting-algorithms-python/#the-timsort-algorithm-in-python&quot;&gt;Timsort&lt;/a&gt; sorting algorithm. He also authored the &lt;a href=&quot;https://realpython.com/python-doctest/&quot;&gt;&lt;code&gt;doctest&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-timer/#estimating-running-time-with-timeit&quot;&gt;&lt;code&gt;timeit&lt;/code&gt;&lt;/a&gt; modules in the Python standard library, along with making many other contributions.&lt;/p&gt;
&lt;p&gt;Take your time to read through the Zen of Python and contemplate its wisdom. But don’t take the aphorisms literally, as they’re more of a guiding set of principles rather than strict instructions. You’ll learn about their humorous origins in the next section.&lt;/p&gt;
&lt;h2 id=&quot;how-did-the-zen-of-python-originate&quot;&gt;How Did the Zen of Python Originate?&lt;a class=&quot;headerlink&quot; href=&quot;#how-did-the-zen-of-python-originate&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The idea of formulating a single document that would encapsulate Python’s fundamental philosophies emerged among the core developers in June 1999. As more and more people began coming to Python from other programming languages, they’d often bring their preconceived notions of software design that weren’t necessarily &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;Pythonic&lt;/a&gt;. To help them follow the spirit of the language, a set of recommendations for writing idiomatic Python was needed.&lt;/p&gt;
&lt;p&gt;The initial discussion about creating such a document took place on the Python mailing list under the subject &lt;em&gt;The Python Way&lt;/em&gt;. Today, you can find this conversation in the official &lt;a href=&quot;https://mail.python.org/pipermail/python-list/1999-June/subject.html&quot;&gt;Python-list archive&lt;/a&gt;. If you look closely at the &lt;a href=&quot;https://mail.python.org/pipermail/python-list/1999-June/001951.html&quot;&gt;first message from Tim Peters&lt;/a&gt; in that thread, then you’ll notice that he clearly outlined the Zen of Python as a joke. That original form has stuck around until this day:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Clearly a job for Guido alone – although I doubt it’s one he’ll take on
(fwiw, I wish he would too!).  Here’s the outline he would start from,
though &amp;lt;wink&amp;gt;:&lt;/p&gt;
&lt;p&gt;Beautiful is better than ugly.&lt;br&gt;
Explicit is better than implicit.&lt;br&gt;
Simple is better than complex.&lt;br&gt;
Complex is better than complicated.&lt;br&gt;
Flat is better than nested.&lt;br&gt;
Sparse is better than dense.&lt;br&gt;
Readability counts.&lt;br&gt;
Special cases aren’t special enough to break the rules.&lt;br&gt;
Although practicality beats purity.&lt;br&gt;
Errors should never pass silently.&lt;br&gt;
Unless explicitly silenced.&lt;br&gt;
In the face of ambiguity, refuse the temptation to guess.&lt;br&gt;
There should be one– and preferably only one –obvious way to do it.&lt;br&gt;
Although that way may not be obvious at first unless you’re Dutch.&lt;br&gt;
Now is better than never.&lt;br&gt;
Although never is often better than &lt;em&gt;right&lt;/em&gt; now.&lt;br&gt;
If the implementation is hard to explain, it’s a bad idea.&lt;br&gt;
If the implementation is easy to explain, it may be a good idea.&lt;br&gt;
Namespaces are one honking great idea – let’s do more of those!&lt;/p&gt;
&lt;p&gt;There you go:  20 Pythonic Fec^H^H^HTheses on the nose, counting the one I’m
leaving for Guido to fill in.  If the answer to &lt;em&gt;any&lt;/em&gt; Python design issue
isn’t obvious after reading those – well, I just give up &amp;lt;wink&amp;gt;. (&lt;a href=&quot;https://mail.python.org/pipermail/python-list/1999-June/001951.html&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The wink and the playful way of self-censoring some &lt;a href=&quot;https://en.wikipedia.org/wiki/Toilet_humour&quot;&gt;toilet humor&lt;/a&gt; are clear giveaways that Tim Peters didn’t want anyone to take his comment too seriously.&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; In case you didn’t get the joke, he started to write something like &lt;em&gt;Feces&lt;/em&gt; but then used &lt;code&gt;^H&lt;/code&gt;—which represents a &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-backspace&quot;&gt;Backspace&lt;/kbd&gt;&lt;/span&gt; in older text editors like &lt;a href=&quot;https://realpython.com/vim-and-python-a-match-made-in-heaven/&quot;&gt;Vim&lt;/a&gt;—to delete the last three letters and make the word &lt;em&gt;Theses&lt;/em&gt;. Therefore, the intended phrase is &lt;em&gt;20 Pythonic Theses&lt;/em&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Eventually, these nearly twenty theses got a proper name and were formally codified in a &lt;a href=&quot;https://peps.python.org/pep-0001/&quot;&gt;Python Enhancement Proposal&lt;/a&gt; document. Each PEP document receives a number. For example, you might have stumbled on &lt;a href=&quot;https://realpython.com/python-pep8/&quot;&gt;PEP 8&lt;/a&gt;, which is the style guide for writing readable Python code. Perhaps as an inside joke, the Zen of Python received the number &lt;a href=&quot;https://peps.python.org/pep-0020/&quot;&gt;PEP 20&lt;/a&gt; to signify the incomplete number of aphorisms in it.&lt;/p&gt;
&lt;p&gt;To win your next argument about what makes good Python code, you can back up your claims with the Zen of Python. If you’d like to refer to a specific aphorism instead of the entire poem, then consider visiting &lt;a href=&quot;https://pep20.org/&quot;&gt;pep20.org&lt;/a&gt;, which provides convenient clickable links to each principle.&lt;/p&gt;
&lt;p&gt;And, in case you want to learn the poem by heart while having some fun, you can now listen to a &lt;a href=&quot;https://www.youtube.com/watch?v=i6G6dmVJy74&quot;&gt;song&lt;/a&gt; with the Zen of Python as its lyrics. &lt;a href=&quot;https://twitter.com/pumpichank&quot;&gt;Barry Warsaw&lt;/a&gt;, another core developer involved with Python since its early days, composed and performed this musical rendition. The song became the closing track on a special vinyl record entitled &lt;a href=&quot;https://www.edgedb.com/blog/the-zen-side-of-the-moon&quot;&gt;&lt;em&gt;The Zen Side of the Moon&lt;/em&gt;&lt;/a&gt;, which was &lt;a href=&quot;https://twitter.com/pyladies/status/1649988104433061888&quot;&gt;auctioned&lt;/a&gt; at &lt;a href=&quot;https://realpython.com/python-news-april-2023/#pycon-us-2023-celebrates-its-twentieth-anniversary&quot;&gt;PyCon US 2023&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Okay. Now that you have a rough idea of what the Zen of Python is and how it came about, you might be asking yourself whether you should really follow it.&lt;/p&gt;
&lt;h2 id=&quot;should-you-obey-the-zen-of-python&quot;&gt;Should You Obey the Zen of Python?&lt;a class=&quot;headerlink&quot; href=&quot;#should-you-obey-the-zen-of-python&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/zen-of-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/zen-of-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>Mazes in Python Part 1: Building and Visualizing</title>
      <id>https://realpython.com/courses/python-maze-solver-part-1/</id>
      <link href="https://realpython.com/courses/python-maze-solver-part-1/"/>
      <updated>2023-06-06T14:00:00+00:00</updated>
      <summary>In part one of this two-part project, you&#x27;ll design your maze and represent it in an object-oriented way. You&#x27;ll also visualize the maze and its solution using scalable vector graphics (SVG).</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re up for a little challenge and would like to take your programming skills to the next level, then you&amp;rsquo;ve come to the right place! In this hands-on video course, you&amp;rsquo;ll practice object-oriented programming, among several other good practices, while building a cool maze solver project in Python.&lt;/p&gt;
&lt;p&gt;This is the first part in a two-part series. Throughout the series, you&amp;rsquo;ll go step by step through the guided process of building a complete and working project. This will include reading a maze from a binary file, visualizing it using scalable vector graphics (SVG), and finding the shortest path from the entrance to the exit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In part one of the series, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use an &lt;strong&gt;object-oriented approach&lt;/strong&gt; to represent the maze in memory&lt;/li&gt;
&lt;li&gt;Visualize the maze and its solution using &lt;strong&gt;scalable vector graphics (SVG)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the next part of the series, you&amp;rsquo;ll complete the project by creating a binary storage format for mazes and solving mazes using NetworkX.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using the NumPy Random Number Generator</title>
      <id>https://realpython.com/numpy-random-number-generator/</id>
      <link href="https://realpython.com/numpy-random-number-generator/"/>
      <updated>2023-06-05T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll take a look at the powerful random number capabilities of the NumPy random number generator. You&#x27;ll learn how to work with both individual numbers and NumPy arrays, as well as how to sample from a statistical distribution.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Random numbers&lt;/strong&gt; are a very useful feature in many different types of programs, from mathematics and data analysis through to computer games and encryption applications. You may be surprised to learn that it’s actually quite difficult to get a computer to generate true randomness. However, if you’re careful, the NumPy random number generator can generate random enough numbers for everyday purposes.&lt;/p&gt;
&lt;p&gt;Maybe you’ve already worked with &lt;a href=&quot;https://realpython.com/python-random/&quot;&gt;randomly generated data in Python&lt;/a&gt;. While modules like &lt;a href=&quot;https://docs.python.org/3/library/random.html#random.Random&quot;&gt;&lt;code&gt;random&lt;/code&gt;&lt;/a&gt; are great options for producing random scalars, using the &lt;a href=&quot;https://numpy.org/doc/stable/reference/random/index.html&quot;&gt;&lt;code&gt;numpy.random&lt;/code&gt;&lt;/a&gt; module will unlock even more possibilities for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Generate NumPy arrays&lt;/strong&gt; of random numbers&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Randomize&lt;/strong&gt; NumPy arrays&lt;/li&gt;
&lt;li&gt;Randomly &lt;strong&gt;select parts&lt;/strong&gt; of NumPy arrays&lt;/li&gt;
&lt;li&gt;Take random samples from &lt;strong&gt;statistical distributions&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before starting this tutorial, you should understand the basics of &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy arrays&lt;/a&gt;. With that knowledge, you’re ready to dive in.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/numpy-random-number-generator-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-numpy-random-number-generator-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that shows you how to get random numbers with NumPy.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-the-numpy-pseudo-random-number-generator&quot;&gt;Understanding the NumPy Pseudo-Random Number Generator&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-the-numpy-pseudo-random-number-generator&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When you ask a computer to perform any task for you, it does so by following a set of instructions defined by an algorithm. When you need it to generate random numbers, the computer uses a &lt;a href=&quot;https://en.wikipedia.org/wiki/Pseudorandom_number_generator&quot;&gt;pseudo-random number generator&lt;/a&gt; (PRNG) algorithm. There are several of these available, some of which are better than others.&lt;/p&gt;
&lt;p&gt;To generate random numbers, Python uses the &lt;a href=&quot;https://docs.python.org/3/library/random.html&quot;&gt;&lt;code&gt;random&lt;/code&gt; module&lt;/a&gt;, which generates numbers using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Mersenne_Twister&quot;&gt;Mersenne twister algorithm&lt;/a&gt;. While this is still widely used in Python code, it’s possible to predict the numbers that it generates, and it requires significant computing power. &lt;/p&gt;
&lt;p&gt;Since version 1.17, NumPy uses the more efficient &lt;a href=&quot;https://en.wikipedia.org/wiki/Permuted_congruential_generator&quot;&gt;permuted congruential generator-64&lt;/a&gt; (PCG64) algorithm. This produces less-predictable numbers, as shown by its performance in the industry-standard &lt;a href=&quot;https://www.pcg-random.org/statistical-tests.html#&quot;&gt;TestU01 statistical test&lt;/a&gt;. PCG64 is also faster and requires fewer resources to work.&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; While the PCG64 algorithm is certainly an improvement on the Mersenne twister algorithm, it still has some statistical weaknesses. An updated version, &lt;a href=&quot;https://numpy.org/doc/stable/reference/random/bit_generators/pcg64dxsm.html&quot;&gt;PCG64DXSM&lt;/a&gt;, addresses these issues. This will become the default in future NumPy releases. On a practical level, you won’t notice any difference, but if you want to know more, see &lt;a href=&quot;https://numpy.org/doc/stable/reference/random/upgrading-pcg64.html#upgrading-pcg64&quot;&gt;Upgrading &lt;code&gt;PCG64&lt;/code&gt; with &lt;code&gt;PCG64DXSM&lt;/code&gt;&lt;/a&gt; in the NumPy documentation.&lt;/p&gt;
&lt;p&gt;In most of the examples throughout this tutorial, you’ll use the default &lt;a href=&quot;https://numpy.org/doc/stable/reference/random/bit_generators/pcg64.html&quot;&gt;PCG64&lt;/a&gt; algorithm, although you’ll also try your hand at using the updated PCG64DXSM algorithm.&lt;/p&gt;
&lt;p&gt;If you’re interested in learning more about the different types of PRNG algorithms and how the PCG algorithms compare to others, then you should read &lt;a href=&quot;https://www.pcg-random.org/&quot;&gt;PCG, A Family of Better Random Number Generators&lt;/a&gt; from the developer of PCG.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;PRNGs are called pseudo-random because they’re &lt;em&gt;not&lt;/em&gt; random! PRNGs are &lt;strong&gt;deterministic&lt;/strong&gt;, which means they generate sequences of numbers that are reproducible. PRNGs require a &lt;a href=&quot;https://en.wikipedia.org/wiki/Random_seed&quot;&gt;seed&lt;/a&gt; number to initialize their number generation. PRNGs that use the same seed will generate the same numbers.&lt;/p&gt;
&lt;p&gt;PRNGs also have a &lt;strong&gt;period&lt;/strong&gt; property, which is the number of iterations they go through before they start repeating. Because the generated numbers depend on the seed, they’re not truly random but are instead pseudo-random.&lt;/p&gt;
&lt;p&gt;Because seeds should be random, you need one random number to generate another. For this purpose, PRNGs use the computer hardware clock’s time as their default seed. This is measured to the nanosecond, so running number generators consecutively results in different seed values and therefore different sequences of random numbers. NumPy uses a &lt;a href=&quot;https://numpy.org/doc/stable/reference/random/bit_generators/index.html#seeding-and-entropy&quot;&gt;hashing technique&lt;/a&gt; to ensure that the seed is 128 bits long, even if you only supply a 64-bit integer.&lt;/p&gt;
&lt;p&gt;The period does mean that the same numbers could reappear. In practice, this isn’t a concern because the period lengths are huge. &lt;a href=&quot;https://numpy.org/doc/stable/reference/random/bit_generators/pcg64.html&quot;&gt;The period of PCG64&lt;/a&gt;, for example, is about 50 billion times the number of atoms that exist inside of you!&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you want to learn more about how random randomly generated numbers actually are, take a look at the tutorial &lt;a href=&quot;https://realpython.com/python-random/#how-random-is-random&quot;&gt;How Random is Random?&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The core of NumPy’s number generation is the &lt;strong&gt;&lt;code&gt;BitGenerator&lt;/code&gt;&lt;/strong&gt; class. This class allows you to specify an algorithm and seed. To access the random numbers, the &lt;code&gt;BitGenerator&lt;/code&gt; is passed into a separate &lt;strong&gt;&lt;code&gt;Generator&lt;/code&gt;&lt;/strong&gt; object. Generators have methods that allow you to access a range of random numbers and perform several randomizing operations. The &lt;a href=&quot;https://numpy.org/doc/stable/reference/random/index.html&quot;&gt;&lt;code&gt;numpy.random&lt;/code&gt;&lt;/a&gt; module provides this capability.&lt;/p&gt;
&lt;p&gt;You may have noticed that the &lt;code&gt;NumPy.random&lt;/code&gt; documentation also contains information about the &lt;a href=&quot;https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState&quot;&gt;&lt;code&gt;RandomState&lt;/code&gt;&lt;/a&gt; class. This is a container class for the slower Mersenne twister PRNG. The more modern &lt;code&gt;Generator&lt;/code&gt; class has now superseded &lt;code&gt;RandomState&lt;/code&gt;, which you should no longer use in new code. However, &lt;code&gt;RandomState&lt;/code&gt; is still around for existing legacy applications. &lt;/p&gt;
&lt;p&gt;Before you go any further, be aware that the NumPy PRNGs are &lt;em&gt;not&lt;/em&gt; suitable for cryptographic purposes. They’re only suitable for data analysis tasks. If you need random numbers for cryptographic purposes, then you need a &lt;a href=&quot;https://realpython.com/python-random/#csprngs-in-python&quot;&gt;cryptographically secure pseudo-random number generator (CSPRNG)&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;generating-random-data-with-the-numpy-random-number-generator&quot;&gt;Generating Random Data With the NumPy Random Number Generator&lt;a class=&quot;headerlink&quot; href=&quot;#generating-random-data-with-the-numpy-random-number-generator&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now that you understand a computer’s capabilities for generating random numbers, in this section, you’ll learn how to generate both floating-point numbers and integers randomly using NumPy. After generating individual numbers, you’ll learn how to generate NumPy arrays of random numbers.&lt;/p&gt;
&lt;h3 id=&quot;random-numbers&quot;&gt;Random Numbers&lt;a class=&quot;headerlink&quot; href=&quot;#random-numbers&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you’re happy to let NumPy perform all of your random number generation work for you, you can use its default values. In other words, your &lt;code&gt;BitGenerator&lt;/code&gt; will use PCG64 with a seed from the computer’s clock. To facilitate the defaults, NumPy provides a very handy &lt;strong&gt;&lt;code&gt;default_rng()&lt;/code&gt;&lt;/strong&gt; function. This sets everything up for you and returns a reference to a &lt;code&gt;Generator&lt;/code&gt; object for you to use to produce random numbers using its range of powerful methods.&lt;/p&gt;
&lt;p&gt;To begin with, this code generates a floating-point number using NumPy’s defaults:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;np&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;default_rng&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;default_rng&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;default_rng&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Generator(PCG64) at 0x1E9F2ABBF20&#x27;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;default_rng&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0.47418635476614734&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/numpy-random-number-generator/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/numpy-random-number-generator/ »&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 #158: Building Python CI With Docker &amp; Applying for a Hacker Initiative Grant</title>
      <id>https://realpython.com/podcasts/rpp/158/</id>
      <link href="https://realpython.com/podcasts/rpp/158/"/>
      <updated>2023-06-02T12:00:00+00:00</updated>
      <summary>Do you need a refresher on using Docker with Python? Would you like to learn how to configure a continuous integration pipeline with modern tools and Docker? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Do you need a refresher on using Docker with Python? Would you like to learn how to configure a continuous integration pipeline with modern tools and Docker? This week on the show, Christopher Trudeau is here, 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>Create and Modify PDF Files in Python</title>
      <id>https://realpython.com/creating-modifying-pdf/</id>
      <link href="https://realpython.com/creating-modifying-pdf/"/>
      <updated>2023-05-31T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll explore the different ways of creating and modifying PDF files in Python. You&#x27;ll learn how to read and extract text, merge and concatenate files, crop and rotate pages, encrypt and decrypt files, and even create PDFs from scratch.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;It’s really useful to know how to create and modify &lt;a href=&quot;https://en.wikipedia.org/wiki/PDF&quot;&gt;PDF (portable document format)&lt;/a&gt; files in Python. This is one of the most common formats for sharing documents over the Internet. &lt;a href=&quot;https://realpython.com/pdf-python/&quot;&gt;PDF files&lt;/a&gt; can contain text, images, tables, forms, and rich media like videos and animations, all in a single file.&lt;/p&gt;
&lt;p&gt;This abundance of content types can make working with PDFs difficult. There are several different kinds of data to decode when opening a PDF file! Fortunately, the Python ecosystem has some great packages for reading, manipulating, and creating PDF files.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Read&lt;/strong&gt; text from a PDF with &lt;code&gt;pypdf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Split&lt;/strong&gt; a PDF file into multiple files&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concatenate&lt;/strong&gt; and &lt;strong&gt;merge&lt;/strong&gt; PDF files together&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rotate&lt;/strong&gt; and &lt;strong&gt;crop&lt;/strong&gt; pages in PDF files&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Encrypt&lt;/strong&gt; and &lt;strong&gt;decrypt&lt;/strong&gt; PDF files&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; and &lt;strong&gt;customize&lt;/strong&gt; PDF files from scratch with ReportLab&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To complete this learning, you’ll use two different tools. You’ll use the &lt;a href=&quot;https://pypdf.readthedocs.io/en/stable/index.html&quot;&gt;&lt;code&gt;pypdf&lt;/code&gt;&lt;/a&gt; library to manipulate existing PDF files and the &lt;a href=&quot;https://docs.reportlab.com/&quot;&gt;ReportLab&lt;/a&gt; library to create new PDF files from scratch. Along the way, you’ll have several opportunities to deepen your understanding with exercises and examples.&lt;/p&gt;
&lt;p&gt;To follow along with this tutorial, you should download and extract to your home folder the materials used in the examples. To do this, click the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Download the sample materials:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/create-modify-pdf/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-create-modify-pdf&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the materials you’ll use&lt;/a&gt; to learn about creating and modifying PDF files in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;extracting-text-from-pdf-files-with-pypdf&quot;&gt;Extracting Text From PDF Files With &lt;code&gt;pypdf&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#extracting-text-from-pdf-files-with-pypdf&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this section, you’ll learn how to read PDF files and extract their text using the &lt;a href=&quot;https://pypi.org/project/pypdf/&quot;&gt;&lt;code&gt;pypdf&lt;/code&gt;&lt;/a&gt; library. Before you can do that, though, you need to 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;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m pip install pypdf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With this command, you download and install the latest version of &lt;code&gt;pypdf&lt;/code&gt; from the Python package index (&lt;a href=&quot;https://realpython.com/pypi-publish-python-package/&quot;&gt;PyPI&lt;/a&gt;). To verify the installation, go ahead and run the following command in your &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;terminal&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m pip show pypdf
&lt;span class=&quot;go&quot;&gt;Name: pypdf&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;Version: 3.8.1&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Summary: A pure-python PDF library capable of splitting,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; merging, cropping, and transforming PDF files&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Home-page:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Author:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Author-email: Mathieu Fenniak &amp;lt;biziqe@mathieu.fenniak.net&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;License:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Location: .../lib/python3.10/site-packages&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Requires:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Required-by:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pay particular attention to the version information. At the time of publication for this tutorial, the latest version of &lt;code&gt;pypdf&lt;/code&gt; was &lt;code&gt;3.8.1&lt;/code&gt;. This library has gotten plenty of updates lately, and cool new features are added quite frequently. Most importantly, you’ll find many breaking changes in the library’s API if you compare it with its predecessor library &lt;a href=&quot;https://pypdf.readthedocs.io/en/stable/meta/history.html#pypdf2-is-born-2011-2016&quot;&gt;&lt;code&gt;PyPDF2&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Before diving into working with PDF files, you must know that this tutorial is adapted from the chapter “Creating and Modifying PDF Files” in &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The book uses Python’s built-in &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; editor to create and edit Python files and interact with the Python shell, so you’ll find occasional references to IDLE throughout this tutorial. However, you should have no problems running the example code from the &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;editor&lt;/a&gt; and environment of your choice.&lt;/p&gt;
&lt;h3 id=&quot;reading-pdf-files-with-pdfreader&quot;&gt;Reading PDF Files With &lt;code&gt;PdfReader&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#reading-pdf-files-with-pdfreader&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To kick things off, you’ll open a PDF file and read some information about it. You’ll use the &lt;code&gt;Pride_and_Prejudice.pdf&lt;/code&gt; file provided in the downloadable resources for this tutorial.&lt;/p&gt;
&lt;p&gt;Open IDLE’s interactive window and &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;import&lt;/a&gt; the &lt;code&gt;PdfReader&lt;/code&gt; class from &lt;code&gt;pypdf&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pypdf&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PdfReader&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To create a new instance of the &lt;code&gt;PdfReader&lt;/code&gt; class, you’ll need to provide the &lt;a href=&quot;https://realpython.com/read-write-files-python/#file-paths&quot;&gt;path&lt;/a&gt; to the PDF file that you want to open. You can do that using the &lt;a href=&quot;https://realpython.com/python-pathlib/&quot;&gt;&lt;code&gt;pathlib&lt;/code&gt;&lt;/a&gt; module:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pathlib&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Path&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;pdf_path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;home&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;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;creating-and-modifying-pdfs&quot;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;practice_files&quot;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Pride_and_Prejudice.pdf&quot;&lt;/span&gt;
&lt;span class=&quot;gp&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;p&gt;The &lt;code&gt;pdf_path&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variable&lt;/a&gt; now contains the path to a PDF version of Jane Austen’s &lt;em&gt;Pride and Prejudice&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You may need to change &lt;code&gt;pdf_path&lt;/code&gt; so that it corresponds to the location of the &lt;code&gt;creating-and-modifying-pdfs/&lt;/code&gt; folder on your computer.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now create the &lt;code&gt;PdfReader&lt;/code&gt; instance by calling the class’s &lt;a href=&quot;https://realpython.com/python-class-constructor/&quot;&gt;constructor&lt;/a&gt; with the path to your PDF file as an argument:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pdf_reader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PdfReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pdf_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/creating-modifying-pdf/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/creating-modifying-pdf/ »&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 the First Match From a Python List or Iterable</title>
      <id>https://realpython.com/courses/python-first-match/</id>
      <link href="https://realpython.com/courses/python-first-match/"/>
      <updated>2023-05-30T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about the best ways to get the first match from a Python list or iterable. You&#x27;ll look into two different strategies, for loops and generators, and compare their performance. Then you&#x27;ll finish up by creating a reusable function for all your first matching needs.</summary>
      <content type="html">
        &lt;p&gt;At some point in your Python journey, you may need to find the &lt;strong&gt;first item that matches a certain criterion&lt;/strong&gt; in a Python &lt;a href=&quot;https://realpython.com/python-for-loop/#iterables&quot;&gt;iterable&lt;/a&gt;, such as a &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The simplest case is that you need to confirm that a particular item exists in the iterable. For example, you want to find a name in a list of names or a &lt;a href=&quot;https://realpython.com/python-string-contains-substring/&quot;&gt;substring inside a string&lt;/a&gt;. In these cases, you&amp;rsquo;re best off using the &lt;code&gt;in&lt;/code&gt; operator. However, there are many use cases when you may want to look for items with specific properties. For instance, you may need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Find a non-zero value in a list of &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Find a name of a particular length in a list of &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Find and modify a dictionary in a list of dictionaries based on a certain attribute&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll explore how best to approach all three scenarios.&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>Choosing the Best Coding Font for Programming</title>
      <id>https://realpython.com/coding-font/</id>
      <link href="https://realpython.com/coding-font/"/>
      <updated>2023-05-29T14:00:00+00:00</updated>
      <summary>The font that you use is an important piece in your tool kit as a programmer. After all, you look at your programming font the whole time when writing code. In this tutorial, you&#x27;ll find your perfect font for coding.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;When you’re coding, there’s always a font involved in displaying the text on the screen. Yet, the font that you use is an often-overlooked piece in your programming tool kit. Many operating systems and code editors come with their default monospace fonts that you may end up using.&lt;/p&gt;
&lt;p&gt;But there are a bunch of technicalities and features to take into consideration when choosing the best font for your daily programming. That’s why it’s worth investigating the requirements that a &lt;strong&gt;programming font&lt;/strong&gt; should fulfill to make it a perfect match for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to spot a &lt;strong&gt;high-quality&lt;/strong&gt; coding font&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;characters&lt;/strong&gt; are important when coding in Python&lt;/li&gt;
&lt;li&gt;Which &lt;strong&gt;features&lt;/strong&gt; of a programming font matter&lt;/li&gt;
&lt;li&gt;Where to &lt;strong&gt;download&lt;/strong&gt; programming fonts&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;install&lt;/strong&gt; a font on your operating system&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Throughout the tutorial, you’ll consider twenty-seven hand-picked programming fonts that you can use right away.
You’ll take a close look at all the fonts and investigate why their particular features are important for you as a programmer.
In the end, you’ll be able to decide which coding fonts suit your needs best.&lt;/p&gt;
&lt;p&gt;If you want to keep a list of the fonts for future reference, then you can get an overview PDF of all the fonts 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;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/coding-font-guide/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-coding-font-guide&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download your comprehensive guide&lt;/a&gt; to all the coding fonts in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;say-hello-to-your-next-coding-font&quot;&gt;Say Hello to Your Next Coding Font&lt;a class=&quot;headerlink&quot; href=&quot;#say-hello-to-your-next-coding-font&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll take a deep dive and learn about the forms and shapes that make a quality coding font.
You’ll encounter significant technical details, handy features, and surprising quirks along the way.&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; In this tutorial, you’ll focus on the characteristics of fonts that are suitable for Python programming. But the fonts will work similarly in any other programming language.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You’ll notice that all the images in this tutorial have a similar style.
The font name is always on the left.
On the right, you’ll see a sample string or specific characters worth noting. To kick things off, have a look at the fonts that you’ll examine in this tutorial:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/font-list.684fdef10e95.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/font-list.684fdef10e95.png&quot; width=&quot;1344&quot; height=&quot;1920&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/font-list.684fdef10e95.png&amp;amp;w=336&amp;amp;sig=e4f27e4d87d2ab6ae30eb990ddd35b52f36d2356 336w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/font-list.684fdef10e95.png&amp;amp;w=448&amp;amp;sig=e487e11ca39420a07fa0d4bd4dd442f55b4fcc0f 448w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/font-list.684fdef10e95.png&amp;amp;w=672&amp;amp;sig=23d61fc97853c497318ded816e86092e3b2f735e 672w, https://files.realpython.com/media/font-list.684fdef10e95.png 1344w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&#x27;Screenshot of all fonts showing a &quot;Hello, World!&quot; string&#x27; data-asset=&quot;5147&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;It’s a good idea to open this image in another window and keep it open while you read the tutorial.
For example, you can right-click the image above, select &lt;em&gt;Open Image in New Window&lt;/em&gt;, and then drag the tab into a new window:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/829906974?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;Having the tutorial and the fonts list side by side lets you conveniently compare certain fonts with others. You can even go a step further and print the image to annotate the fonts with your likes and dislikes.&lt;/p&gt;
&lt;p&gt;If you’re already excited to try out new fonts in your own coding editor, then you can scroll down to the &lt;a href=&quot;#get-your-new-coding-font&quot;&gt;get your new coding font&lt;/a&gt; section.
There you can download all the fonts in this tutorial and load them up in your editor.
That way, you can get a head start and evaluate any font with your own editor theme, preferred font size, and some familiar code.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Color schemes and font sizes are very personal settings that can easily skew your evaluation of a font.
That’s why you won’t see any larger code samples set in any font in this tutorial.&lt;/p&gt;
&lt;p&gt;Instead, you’ll see many examples that objectively focus on specific font characteristics, independently of any coding editors.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Once you try out a coding font, you’ll recognize if you like or dislike it.
Sometimes it’s just a matter of taste.
But sometimes there are reasons why one font might be a better fit for you while another isn’t.&lt;/p&gt;
&lt;p&gt;Over the next few sections, you’ll get a tool set so that you can evaluate for yourself what makes a quality programming font.&lt;/p&gt;
&lt;h2 id=&quot;consider-the-basics&quot;&gt;Consider the Basics&lt;a class=&quot;headerlink&quot; href=&quot;#consider-the-basics&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Whether you just wrote your first &lt;a href=&quot;https://en.wikipedia.org/wiki/%22Hello,_World!%22_program&quot;&gt;&lt;code&gt;Hello, World!&lt;/code&gt;&lt;/a&gt; script or maintain huge codebases, choosing the right programming font will be beneficial for you as a developer.&lt;/p&gt;
&lt;p&gt;Before you dig into the characteristics of a font on a character level, there are some broader features to take into consideration. Some of them may filter out a font in your search from the get-go.&lt;/p&gt;
&lt;p&gt;For example, a font might not be a good choice if the font doesn’t support your language or if it costs money that you’re not willing to invest. Another criterion could be that the font must be monospace.&lt;/p&gt;
&lt;p&gt;In this section, you’ll explore important points of comparison.
That way, you’ll know which fonts to include in your circle of coding fonts to consider more closely.&lt;/p&gt;
&lt;h3 id=&quot;does-the-font-file-format-matter&quot;&gt;Does the Font File Format Matter?&lt;a class=&quot;headerlink&quot; href=&quot;#does-the-font-file-format-matter&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/coding-font/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/coding-font/ »&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 #157: Discussing Mojo &amp; Improving Python Object-Oriented Programming</title>
      <id>https://realpython.com/podcasts/rpp/157/</id>
      <link href="https://realpython.com/podcasts/rpp/157/"/>
      <updated>2023-05-26T12:00:00+00:00</updated>
      <summary>Would you like to speed up your Python machine-learning code dramatically? What if you only had to change a few keywords and add a couple of type hints on portions of your code? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Would you like to speed up your Python machine-learning code dramatically? What if you only had to change a few keywords and add a couple of type hints on portions of your code? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s .__call__() Method: Creating Callable Instances</title>
      <id>https://realpython.com/python-callable-instances/</id>
      <link href="https://realpython.com/python-callable-instances/"/>
      <updated>2023-05-24T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what a callable is in Python and how to create callable instances using the .__call__() special method in your custom classes. You&#x27;ll also code several examples of practical use cases for callable instances in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In Python, a &lt;strong&gt;callable&lt;/strong&gt; is any object that you can call using a pair of parentheses and, optionally, a series of arguments. Functions, classes, and methods are all common examples of callables in Python. Besides these, you can also create custom classes that produce &lt;strong&gt;callable instances&lt;/strong&gt;. To do this, you can add the &lt;strong&gt;&lt;code&gt;.__call__()&lt;/code&gt;&lt;/strong&gt; special method to your class.&lt;/p&gt;
&lt;p&gt;Instances of a class with a &lt;code&gt;.__call__()&lt;/code&gt; method behave like functions, providing a flexible and handy way to add functionality to your objects. Understanding how to create and use callable instances is a valuable skill for you as a Python developer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand the concept of &lt;strong&gt;callable objects&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;callable instances&lt;/strong&gt; by providing your classes with a &lt;strong&gt;&lt;code&gt;.__call__()&lt;/code&gt;&lt;/strong&gt; method&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;difference&lt;/strong&gt; between &lt;strong&gt;&lt;code&gt;.__init__()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;.__call__()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Code several examples of using callable instances to solve &lt;strong&gt;real-world problems&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should be comfortable with the basics of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented&lt;/a&gt; programming in Python, including how to define and use &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt; and methods. Some familiarity with Python &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt; and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Strategy_pattern&quot;&gt;strategy design pattern&lt;/a&gt; will also help. You should also understand the concept of &lt;a href=&quot;https://en.wikipedia.org/wiki/State_(computer_science)&quot;&gt;state&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-callable-instances-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-callable-instances-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download your sample code&lt;/a&gt; so that you can create callable instances with Python’s &lt;code&gt;.__call__()&lt;/code&gt; method.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-callable-objects-in-python&quot;&gt;Understanding Callable Objects in Python&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-callable-objects-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-callable&quot;&gt;callable&lt;/a&gt; in Python is any object that you can call using a pair of parentheses and a series of arguments if required. You’ll find different examples of callables in your daily interaction with Python. Some of them include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/library/functions.html&quot;&gt;Built-in&lt;/a&gt; functions and classes&lt;/li&gt;
&lt;li&gt;User-defined &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt; that you create with the &lt;a href=&quot;https://realpython.com/python-keywords/#the-def-keyword&quot;&gt;&lt;code&gt;def&lt;/code&gt;&lt;/a&gt; keyword&lt;/li&gt;
&lt;li&gt;Anonymous functions that you write using the &lt;a href=&quot;https://realpython.com/python-lambda/&quot;&gt;&lt;code&gt;lambda&lt;/code&gt;&lt;/a&gt; keyword&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://realpython.com/python-class-constructor/&quot;&gt;constructors&lt;/a&gt; of your custom &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-classes/#instance-methods-with-self&quot;&gt;Instance&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-classes/#class-methods-with-classmethod&quot;&gt;class&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-classes/#static-methods-with-staticmethod&quot;&gt;static&lt;/a&gt; methods&lt;/li&gt;
&lt;li&gt;Instances of classes that implement the &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__call__&quot;&gt;&lt;code&gt;.__call__()&lt;/code&gt;&lt;/a&gt; method&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/inner-functions-what-are-they-good-for/#retaining-state-with-inner-functions-closures&quot;&gt;Closures&lt;/a&gt; that you return from your functions&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/introduction-to-python-generators/&quot;&gt;Generator&lt;/a&gt; functions that you define using the &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/#understanding-the-python-yield-statement&quot;&gt;&lt;code&gt;yield&lt;/code&gt;&lt;/a&gt; keyword&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-async-features/&quot;&gt;Asynchronous&lt;/a&gt; functions and methods that you create with the &lt;a href=&quot;https://realpython.com/python-keywords/#the-async-keyword&quot;&gt;&lt;code&gt;async&lt;/code&gt;&lt;/a&gt; keyword&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All these different callables have something in common. They all implement the &lt;code&gt;.__call__()&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-classes/#special-methods-and-protocols&quot;&gt;special method&lt;/a&gt;. To confirm this fact, you can use the built-in &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#dir&quot;&gt;&lt;code&gt;dir()&lt;/code&gt;&lt;/a&gt; function, which takes an object as an argument and &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;returns&lt;/a&gt; the object’s list of attributes and methods:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&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;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;    &#x27;__call__&#x27;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;    &#x27;__class__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    ...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;all&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;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;    &#x27;__call__&#x27;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;    &#x27;__class__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    ...&lt;/span&gt;
&lt;span class=&quot;go&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;greet&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;s2&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;greet&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;    &#x27;__annotations__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    &#x27;__builtins__&#x27;,&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;    &#x27;__call__&#x27;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;    ...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the first two examples, you call &lt;code&gt;dir()&lt;/code&gt; with the built-in &lt;a href=&quot;https://realpython.com/python-absolute-value/&quot;&gt;&lt;code&gt;abs()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-all/&quot;&gt;&lt;code&gt;all()&lt;/code&gt;&lt;/a&gt; functions as arguments. In both cases, you can see that the &lt;code&gt;.__call__()&lt;/code&gt; method is present in the output.&lt;/p&gt;
&lt;p&gt;In the final example, you define a custom function that &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;prints&lt;/a&gt; a message to the screen. This function also has &lt;code&gt;.__call__()&lt;/code&gt;. Note how you can use this method to call the function:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;greet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;fm&quot;&gt;__call__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello, World!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that using &lt;code&gt;.__call__()&lt;/code&gt; as you did in this example produces the same effect as calling the function directly with &lt;code&gt;greet()&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Even though you can call special methods like &lt;code&gt;.__call__()&lt;/code&gt; directly, doing so isn’t a recommended or best practice. Instead, call the functions as usual.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now, how does all this work internally? When you run something like &lt;code&gt;callable_object(*args, **kwargs)&lt;/code&gt;, Python internally translates the operation into &lt;code&gt;callable_object.__call__(*args, **kwargs)&lt;/code&gt;. The arguments to the regular function are the same as those used in &lt;code&gt;.__call__()&lt;/code&gt;. In other words, whenever you call a callable object, Python automatically runs its &lt;code&gt;.__call__()&lt;/code&gt; method behind the scenes using the arguments you’ve passed into the callable.&lt;/p&gt;
&lt;p&gt;Now take a look at the following custom class:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SampleClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;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;s2&quot;&gt;&quot;You called method()!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SampleClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;class &#x27;type&#x27;&amp;gt;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    &#x27;__abstractmethods__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    &#x27;__annotations__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    &#x27;__base__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    &#x27;__bases__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    &#x27;__basicsize__&#x27;,&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;    &#x27;__call__&#x27;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;    ...&lt;/span&gt;
&lt;span class=&quot;go&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;sample_instance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SampleClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sample_instance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;method&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;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;    &#x27;__call__&#x27;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;    &#x27;__class__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    ...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In Python, everything is an object. Classes like &lt;code&gt;SampleClass&lt;/code&gt; are objects of &lt;code&gt;type&lt;/code&gt;, which you can confirm by calling &lt;code&gt;type()&lt;/code&gt; with the class object as an argument or by accessing the &lt;code&gt;.__class__&lt;/code&gt; attribute.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://realpython.com/python-class-constructor/&quot;&gt;class constructor&lt;/a&gt; of &lt;code&gt;SampleClass&lt;/code&gt; falls back to using &lt;code&gt;type.__call__()&lt;/code&gt;. That’s why you can call &lt;code&gt;SampleClass()&lt;/code&gt; to get a new instance. So, class constructors are callable objects that return new instances of the underlying class.&lt;/p&gt;
&lt;p&gt;In the example above, you can observe that method objects, like &lt;code&gt;sample_instance.method&lt;/code&gt;, also have a &lt;code&gt;.__call__()&lt;/code&gt; special method that turns them into callable objects. The main takeaway here is that to be callable, an object needs to have a &lt;code&gt;.__call__()&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;If you inspect a closure, generator function, or asynchronous function, then you’ll get similar results. You’ll always find a &lt;code&gt;.__call__()&lt;/code&gt; method in callable objects.&lt;/p&gt;
&lt;h2 id=&quot;checking-whether-an-object-is-callable&quot;&gt;Checking Whether an Object Is Callable&lt;a class=&quot;headerlink&quot; href=&quot;#checking-whether-an-object-is-callable&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you ever need to check whether a Python object is callable, then you can use the built-in &lt;a href=&quot;https://docs.python.org/3/library/functions.html?highlight=object#callable&quot;&gt;&lt;code&gt;callable()&lt;/code&gt;&lt;/a&gt; function like in the following examples:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-callable-instances/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-callable-instances/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using k-Nearest Neighbors (kNN) in Python</title>
      <id>https://realpython.com/courses/knn-python/</id>
      <link href="https://realpython.com/courses/knn-python/"/>
      <updated>2023-05-23T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn all about the k-nearest neighbors (kNN) algorithm in Python, including how to implement kNN from scratch. Once you understand how kNN works, you&#x27;ll use scikit-learn to facilitate your coding process.</summary>
      <content type="html">
        &lt;p&gt;In this video course, you&amp;rsquo;ll get a thorough introduction to the k-Nearest Neighbors (kNN) algorithm in Python. The kNN algorithm is one of the most famous &lt;a href=&quot;https://realpython.com/learning-paths/machine-learning-python/&quot;&gt;machine learning&lt;/a&gt; algorithms and an absolute must-have in your machine learning toolbox. Python is the go-to programming language for machine learning, so what better way to discover kNN than with Python&amp;rsquo;s famous packages &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt; and &lt;a href=&quot;https://scikit-learn.org/stable/&quot;&gt;scikit-learn&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll explore the kNN algorithm both in theory and in practice. It&amp;rsquo;s important to learn about the mechanics of machine learning algorithms to understand their potential and limitations. At the same time, it&amp;rsquo;s essential to understand how to use an algorithm in practice. With that in mind, you&amp;rsquo;ll also focus on the use of kNN in the Python library scikit-learn.&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;Explain the &lt;strong&gt;kNN algorithm&lt;/strong&gt; both intuitively and mathematically&lt;/li&gt;
&lt;li&gt;Implement kNN in Python &lt;strong&gt;from scratch&lt;/strong&gt; using &lt;strong&gt;NumPy&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use kNN in Python with &lt;strong&gt;scikit-learn&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>How to Launch an HTTP Server in One Line of Python Code</title>
      <id>https://realpython.com/python-http-server/</id>
      <link href="https://realpython.com/python-http-server/"/>
      <updated>2023-05-22T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to host files with a single command using an HTTP server built into Python. You&#x27;ll also extend it by making a miniature web framework able to serve dynamic content from HTML templates. Along the way, you&#x27;ll run CGI scripts and use encryption over HTTPS.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Traditionally, if you wanted to handle &lt;a href=&quot;https://realpython.com/urllib-request/&quot;&gt;HTTP requests&lt;/a&gt; and serve &lt;strong&gt;static content&lt;/strong&gt; from files, then you had to set up a full-fledged web server like &lt;a href=&quot;https://httpd.apache.org/&quot;&gt;Apache&lt;/a&gt; or &lt;a href=&quot;https://www.nginx.com/&quot;&gt;NGINX&lt;/a&gt;, which could be a tedious process. Building a &lt;strong&gt;dynamic web application&lt;/strong&gt; requires installing a web framework, such as &lt;a href=&quot;https://realpython.com/learning-paths/django-web-development/&quot;&gt;Django&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/flask-connexion-rest-api/&quot;&gt;Flask&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/fastapi-python-web-apis/&quot;&gt;FastAPI&lt;/a&gt;, which adds yet another complexity layer. Fortunately, you can take advantage of a basic HTTP server built into Python to avoid all this hassle.&lt;/p&gt;
&lt;p&gt;Python’s HTTP server can come in handy when you want to quickly &lt;strong&gt;share a bunch of files&lt;/strong&gt; with students in a classroom or anyone else who’s connected to the same network as you. Maybe you need to host static resources downloaded from the Internet for &lt;strong&gt;offline development&lt;/strong&gt; of a &lt;a href=&quot;https://realpython.com/pyscript-python-in-browser/#download-pyscript-for-offline-development&quot;&gt;PyScript&lt;/a&gt; application or spin up a local web server to experiment with the HTTP protocol in your terminal. You may also have a &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;Python script&lt;/a&gt; that should be triggered remotely.&lt;/p&gt;
&lt;p&gt;You can do all of this with a single command thanks to the &lt;a href=&quot;https://docs.python.org/3/library/http.server.html&quot;&gt;&lt;code&gt;http.server&lt;/code&gt;&lt;/a&gt; module that ships with the Python standard library!&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-http-server-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-http-server-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that shows you how to write a one-liner Python HTTP server and more.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;how-to-start-pythons-httpserver-in-the-command-line&quot;&gt;How to Start Python’s &lt;code&gt;http.server&lt;/code&gt; in the Command Line&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-start-pythons-httpserver-in-the-command-line&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Open a command prompt or &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;terminal&lt;/a&gt; window and navigate to the directory where you want to launch the HTTP server. Alternatively, on most modern operating systems, you can right-click a given folder and choose to open the terminal there. Once you’re in the correct place, type and run the following command:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3 -m http.server
&lt;span class=&quot;go&quot;&gt;Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Python starts an HTTP server on port &lt;code&gt;8000&lt;/code&gt; and binds it to all the available network interfaces on your machine, which are denoted with a special &lt;a href=&quot;https://en.wikipedia.org/wiki/IP_address&quot;&gt;IP address&lt;/a&gt;. Depending on your operating system’s preference, the underlying &lt;a href=&quot;https://realpython.com/python-sockets/&quot;&gt;&lt;code&gt;socket&lt;/code&gt;&lt;/a&gt; library may choose to bind to IPv4 address &lt;code&gt;0.0.0.0&lt;/code&gt; or IPv6 address &lt;code&gt;::&lt;/code&gt;. Either way, anyone on your network can use your computer’s IP address to access the HTTP server that you just started.&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 find your local IP address, you can check your network settings or, depending on your operating system, use one of the commands below:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;macOS:&lt;/strong&gt; &lt;code&gt;ifconfig&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Windows:&lt;/strong&gt; &lt;code&gt;ipconfig&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Linux:&lt;/strong&gt; &lt;code&gt;ip address&lt;/code&gt; or &lt;code&gt;hostname -I&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Visiting a website like &lt;a href=&quot;https://ifconfig.me/&quot;&gt;ifconfig.me&lt;/a&gt; will reveal your public IP address, which is typically the address of your router. It’s most likely different from the local address of the device that you’re using. Unless you’ve configured &lt;a href=&quot;https://en.wikipedia.org/wiki/Port_forwarding&quot;&gt;port forwarding&lt;/a&gt; in your router, the HTTP server won’t be accessible from the Internet through your public address.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;If the default port number, &lt;code&gt;8000&lt;/code&gt;, is unavailable, then you’ll see the following error when you make an attempt to start the server:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3 -m http.server
&lt;span class=&quot;go&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  ...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;OSError: [Errno 98] Address already in use&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This means that another program is currently occupying that port. To fix this problem, you can find the offending program and forcefully stop it. However, because that may not always be desirable, you can also assign a different port to your server. To explicitly set the port number that your HTTP server should be listening on, append it as a parameter:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3 -m http.server &lt;span class=&quot;m&quot;&gt;8080&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Serving HTTP on 0.0.0.0 port 8080 (http://0.0.0.0:8080/) ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Sometimes, it takes trial and error to find a free port, especially when many services are running in the background while listening for network traffic on different ports. Remember that a given port can belong to at most one program at a time, but the same program can own multiple ports simultaneously. Usually, each port is associated with a different service.&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; Web browsers automatically use port &lt;code&gt;80&lt;/code&gt; to communicate with web servers over the HTTP protocol, even when you don’t explicitly specify the port number in the address bar. For example, these two addresses are equivalent:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http://localhost:80&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://localhost&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Port &lt;code&gt;80&lt;/code&gt; is a standard port reserved for HTTP traffic. However, if you’d like to start a local web server on that special port, then you’ll have to run the corresponding command as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Superuser&quot;&gt;superuser&lt;/a&gt; with administrative privileges. Otherwise, you’ll get another error:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3 -m http.server &lt;span class=&quot;m&quot;&gt;80&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  ...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;PermissionError: [Errno 13] Permission denied&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;All port numbers below &lt;code&gt;1024&lt;/code&gt; require administrative privileges. You can prefix a command with &lt;a href=&quot;https://en.wikipedia.org/wiki/Sudo&quot;&gt;&lt;code&gt;sudo&lt;/code&gt;&lt;/a&gt; to run it as the root user on macOS and Linux. On the other hand, to run a similar command with elevated privileges on Windows, you must first open the terminal as an administrator.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;For security reasons, you may restrict access to your HTTP server by running it on an address belonging to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Loopback&quot;&gt;virtual loopback interface&lt;/a&gt; or &lt;code&gt;localhost&lt;/code&gt;, which no one except you will be able to speak to. You can bind a specific network interface or IP address by using the &lt;code&gt;-b&lt;/code&gt; option:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3 -m http.server -b &lt;span class=&quot;m&quot;&gt;127&lt;/span&gt;.0.0.42 &lt;span class=&quot;m&quot;&gt;8080&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Serving HTTP on 127.0.0.42 port 8080 (http://127.0.0.42:8080/) ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this case, you combine the &lt;code&gt;-b&lt;/code&gt; option, which binds a specific address on the loopback interface, with a positional argument determining the port number. These parameters ensure that your server will only be accessible from the local machine.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When you rely on the defaults, Python will bind to a network address family that your operating system prefers. To enforce a different address, you can use the &lt;code&gt;-b&lt;/code&gt; option:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m http.server -b &lt;span class=&quot;s2&quot;&gt;&quot;::&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Serving HTTP on :: port 8000 (http://[::]:8000/) ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The double colon (&lt;code&gt;::&lt;/code&gt;) is a shorthand notation for &lt;a href=&quot;https://en.wikipedia.org/wiki/IPv6_address#Unspecified_address&quot;&gt;IPv6 unspecified address&lt;/a&gt;. In most cases, binding to an IPv6 address will enable &lt;a href=&quot;https://en.wikipedia.org/wiki/IPv6#Dual-stack_IP_implementation&quot;&gt;dual-stack IP&lt;/a&gt; mode, letting you connect to the server through both IPv4 and IPv6 addresses. However, it doesn’t work the other way around, so binding to an IPv4 address won’t allow you to connect to the server through an IPv6 address.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;By default, Python serves the files located in your &lt;a href=&quot;https://en.wikipedia.org/wiki/Working_directory&quot;&gt;current working directory&lt;/a&gt; where you executed the command to start the server. So, when you visit the home address (&lt;code&gt;/&lt;/code&gt;) of your server in a web browser, then you’ll see all the files and folders in the corresponding directory:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/web_browser.b85bdf6e08ad.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/web_browser.b85bdf6e08ad.png&quot; width=&quot;1384&quot; height=&quot;961&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/web_browser.b85bdf6e08ad.png&amp;amp;w=346&amp;amp;sig=bd888c456aaea9cdc26d6309d2982621655b6d70 346w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/web_browser.b85bdf6e08ad.png&amp;amp;w=461&amp;amp;sig=20a82e8bc55d9d0bf75d2abae3fc6e7db65151d7 461w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/web_browser.b85bdf6e08ad.png&amp;amp;w=692&amp;amp;sig=4c2b9b02ede670950959e2739477637aa20d929e 692w, https://files.realpython.com/media/web_browser.b85bdf6e08ad.png 1384w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Directory Listing Generated by Python&#x27;s HTTP Server&quot; data-asset=&quot;5090&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Directory listing generated by Python&#x27;s HTTP server&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Here, you see the content of your &lt;a href=&quot;https://en.wikipedia.org/wiki/Home_directory&quot;&gt;home directory&lt;/a&gt;, which is where the server must’ve been started in the command line. Clicking one of the displayed links will send another request to the server, letting you navigate the directory tree in the browser.&lt;/p&gt;
&lt;p&gt;You may instruct the server to associate its home address (&lt;code&gt;/&lt;/code&gt;) with a completely different directory by specifying the optional &lt;code&gt;-d&lt;/code&gt; parameter:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3 -m http.server -d ~/Pictures/
&lt;span class=&quot;go&quot;&gt;Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now, the server will list the pictures in one of your home directory’s subfolders. Your shell expands the tilde character (&lt;code&gt;~&lt;/code&gt;) into the home directory of the current user. Note that you can use both &lt;strong&gt;relative&lt;/strong&gt; and &lt;strong&gt;absolute paths&lt;/strong&gt; to indicate a directory to serve over HTTP.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-http-server/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-http-server/ »&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>ChatGPT: Your Personal Python Coding Mentor</title>
      <id>https://realpython.com/chatgpt-coding-mentor-python/</id>
      <link href="https://realpython.com/chatgpt-coding-mentor-python/"/>
      <updated>2023-05-17T14:00:00+00:00</updated>
      <summary>Large language models have gained popularity since OpenAI released ChatGPT. In this tutorial, you&#x27;ll learn how to use ChatGPT as your Python coding mentor. You&#x27;ll study a variety of use cases, learn how to interpret results, and see that you need to beware of incorrect and irrelevant responses.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Large_language_model&quot;&gt;Large language models (LLMs)&lt;/a&gt; have quickly gained popularity since OpenAI released ChatGPT for public access. Since then, people have used ChatGPT for fun, creative, and useful purposes. If you’ve dreamed about using ChatGPT as your &lt;strong&gt;Python coding mentor&lt;/strong&gt;, then keep on reading.&lt;/p&gt;
&lt;p&gt;Using ChatGPT as your mentor doesn’t mean that you should try to build a software solution without knowing anything about programming. Instead, you’ll focus on using ChatGPT as a &lt;strong&gt;learning tool&lt;/strong&gt;. It probably can’t replace you as a programmer, but it &lt;em&gt;can&lt;/em&gt; help you to improve your code and learn in the process.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Set up ChatGPT&lt;/strong&gt; for use&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debug&lt;/strong&gt; your code using ChatGPT&lt;/li&gt;
&lt;li&gt;Improve your &lt;strong&gt;code style&lt;/strong&gt; and &lt;strong&gt;code quality&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pair program&lt;/strong&gt; with ChatGPT&lt;/li&gt;
&lt;li&gt;Explore &lt;strong&gt;alternative implementations&lt;/strong&gt; of a code snippet&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Get answers&lt;/strong&gt; to your programming questions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also get to see examples of how ChatGPT can produce incorrect and irrelevant solutions, and you’ll learn how you can improve its responses by working on better &lt;strong&gt;prompts&lt;/strong&gt;. In the downloadable materials, you get access to all the code snippets in the tutorial, as well as all the prompts that you’ll use to interact with ChatGPT:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/chatgpt-coding-mentor-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-chatgpt-coding-mentor-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code and engineered prompts&lt;/a&gt; that show you how to boost your Python programming skills with the help of ChatGPT.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;set-up-your-chatgpt-coding-mentor&quot;&gt;Set Up Your ChatGPT Coding Mentor&lt;a class=&quot;headerlink&quot; href=&quot;#set-up-your-chatgpt-coding-mentor&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To access ChatGPT, you only need to create an account with OpenAI. When you first head to &lt;a href=&quot;https://chat.openai.com/&quot;&gt;chat.openai.com&lt;/a&gt;, then you’ll be prompted to either sign in or sign up:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/chatgpt-landing.d3911ef24683.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/chatgpt-landing.d3911ef24683.png&quot; width=&quot;2880&quot; height=&quot;1800&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-landing.d3911ef24683.png&amp;amp;w=720&amp;amp;sig=2f386133ba49267835c48e0a025d744b98a32e09 720w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-landing.d3911ef24683.png&amp;amp;w=960&amp;amp;sig=e153fab6d128674ed85044c75ecda99793fbce29 960w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-landing.d3911ef24683.png&amp;amp;w=1440&amp;amp;sig=9f67846e6bd2f5dd41b61b08b86e62ea6aa4f938 1440w, https://files.realpython.com/media/chatgpt-landing.d3911ef24683.png 2880w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Landing page of ChatGPT giving you options to sign up or sign in&quot; data-asset=&quot;5009&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;If you’ve already played with ChatGPT before and have an active account, then sign in and skip to the &lt;a href=&quot;#beware-of-incorrect-and-irrelevant-information&quot;&gt;next section&lt;/a&gt;. Otherwise, continue reading for a quick walk-through on signing up for the service.&lt;/p&gt;
&lt;p&gt;If you don’t have an account with OpenAI yet, then click on &lt;em&gt;Sign up&lt;/em&gt;. You’ll be redirected to a page that allows you to sign up using your Google or Microsoft account or a personal email address:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/chatgpt-signup.28ca2d16c5b2.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/chatgpt-signup.28ca2d16c5b2.png&quot; width=&quot;2880&quot; height=&quot;1800&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-signup.28ca2d16c5b2.png&amp;amp;w=720&amp;amp;sig=8d250c41cdd4195103b06ba74024ad101f23b39a 720w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-signup.28ca2d16c5b2.png&amp;amp;w=960&amp;amp;sig=ffdb6f41e33260d8067adde6da0e6fca96fff17e 960w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-signup.28ca2d16c5b2.png&amp;amp;w=1440&amp;amp;sig=3870b171e23b2e8f556c389b1062cfe1dfd9ae86 1440w, https://files.realpython.com/media/chatgpt-signup.28ca2d16c5b2.png 2880w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;ChatGPT sign up page, giving options to create an account via email, Google, or Microsoft&quot; data-asset=&quot;5010&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;If you choose to sign up using your email address, then you’ll need to enter a password next. Choose a strong password and complete the sign-up process.&lt;/p&gt;
&lt;p&gt;You’ll then be redirected to the main page of ChatGPT, where you’ll get to interact with the large language model through a conversational interface where you enter questions, and the chat provides answers:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/chatgpt-main-page.ab9b61401995.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/chatgpt-main-page.ab9b61401995.png&quot; width=&quot;2880&quot; height=&quot;1800&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-main-page.ab9b61401995.png&amp;amp;w=720&amp;amp;sig=0c161d422f43364ffc1c6fe761e3ee46603eadc9 720w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-main-page.ab9b61401995.png&amp;amp;w=960&amp;amp;sig=8d34bb21716658db6a66e05c4b711757261e27cb 960w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/chatgpt-main-page.ab9b61401995.png&amp;amp;w=1440&amp;amp;sig=90275f733ec590e50ae5bf66a74287625584e3bd 1440w, https://files.realpython.com/media/chatgpt-main-page.ab9b61401995.png 2880w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;ChatGPT main chat page, showing the conversation tab on the left side, and suggested prompts to the right&quot; data-asset=&quot;5012&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;In the future, you can navigate to &lt;code&gt;chat.openai.com&lt;/code&gt; to directly access this page since you’ve completed the sign-up process. Every so often, after your browser session expires, you’ll have to log in again.&lt;/p&gt;
&lt;h2 id=&quot;beware-of-incorrect-and-irrelevant-information&quot;&gt;Beware of Incorrect and Irrelevant Information&lt;a class=&quot;headerlink&quot; href=&quot;#beware-of-incorrect-and-irrelevant-information&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now that you’ve signed up for ChatGPT, you probably want to give it a spin! But before you hit the throttle, it’s important to know what kinds of issues you might run into. While large language models offer several new possibilities for enhancing your studies, you need to remember the potentially negative effects of using ChatGPT as your coding mentor:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Overreliance:&lt;/strong&gt; Leaning too heavily on ChatGPT for answers can hinder your own learning. You build brain paths by thinking, struggling, checking your understanding, and memorizing information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Accuracy:&lt;/strong&gt; ChatGPT’s responses may often be inaccurate or irrelevant. You need to fact-check all of its answers! Otherwise, you might learn wrong concepts and bad practices.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this section and throughout the tutorial, you’ll encounter a few examples of incorrect and irrelevant answers. Hopefully, these examples will help you keep in mind that even if ChatGPT’s responses seem logical at first sight, they’re not always correct. Sometimes the errors in a response are so subtle that you’ll spot them only if you’re an expert programmer.&lt;/p&gt;
&lt;p&gt;In a classic workflow with ChatGPT, you ask a question in the chat interface, and the underlying language model, &lt;a href=&quot;https://en.wikipedia.org/wiki/GPT-3#GPT-3.5&quot;&gt;GPT-3.5&lt;/a&gt;, will create a reply that you’ll see pop up as a chat response. ChatGPT will even format the replies in useful ways. For example, go ahead and ask the chat to generate some useful Python learning material for you:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; Please show me a table with a cheat sheet of Python’s syntax.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When you ask ChatGPT for a table, then it’ll create &lt;a href=&quot;https://www.markdownguide.org/getting-started/#what-is-markdown&quot;&gt;Markdown&lt;/a&gt; that the chat interface knows to display beautifully. As for the content of that cheat sheet, it’ll pick &lt;em&gt;some&lt;/em&gt; of Python’s syntax, and the results &lt;em&gt;might&lt;/em&gt; be correct and relevant:&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/815373647?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;The table that you’ll receive as output will most likely be different. It could be quite similar, but it doesn’t have to be. The LLM behind ChatGPT will always create a new response, predicting the most likely next piece of information based on its training. But the output isn’t deterministic, and it’s often even incorrect.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/chatgpt-coding-mentor-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/chatgpt-coding-mentor-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>Metaclasses in Python</title>
      <id>https://realpython.com/courses/python-metaclasses/</id>
      <link href="https://realpython.com/courses/python-metaclasses/"/>
      <updated>2023-05-16T14:00:00+00:00</updated>
      <summary>Metaclasses are an important but mysterious behind-the-scenes mechanism for instantiating classes in Python. In this video course, you&#x27;ll learn how Python&#x27;s metaclasses work in object-oriented programming.</summary>
      <content type="html">
        &lt;p&gt;In Python, everything is an object, even the classes that create objects. You
used a class to instantiate an object instance, but classes themselves are
also instantiated behind the scenes. This mechanism is available to you as a
programmer through the concept of metaclasses. &lt;/p&gt;
&lt;p&gt;Metaclasses allow you to hook
when classes are created, and this technique is what&amp;rsquo;s behind magical
frameworks like Django and SQLAlchemy where class definitions have side
effects that impact databases.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course you&amp;rsquo;ll learn about how:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Everything really is an object, including classes themselves&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;type()&lt;/code&gt; function works&lt;/li&gt;
&lt;li&gt;Classes instantiate objects and get instantiated themselves&lt;/li&gt;
&lt;li&gt;You can hook class instantiation with the metaclass argument&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Metaclasses aren&amp;rsquo;t for the faint of heart, but they do allow you to do some magic. Plus, learning about them can help you understand what exactly happens behind the scenes when you instantiate a class.&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 #156: Virtual Environment Structure &amp; Surveying the Packaging Ecosystem</title>
      <id>https://realpython.com/podcasts/rpp/156/</id>
      <link href="https://realpython.com/podcasts/rpp/156/"/>
      <updated>2023-05-12T12:00:00+00:00</updated>
      <summary>How do Python virtual environments work under the hood? How does understanding these concepts help you with managing them for your projects? This week on the show, CPython core developer Brett Cannon returns to discuss his recent articles about virtual environments and the Python packaging landscape.</summary>
      <content type="html">
        &lt;p&gt;How do Python virtual environments work under the hood? How does understanding these concepts help you with managing them for your projects? This week on the show, CPython core developer Brett Cannon returns to discuss his recent articles about virtual environments and the Python packaging landscape.&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>Getting the Most Out of the Python Standard REPL</title>
      <id>https://realpython.com/courses/python-repl/</id>
      <link href="https://realpython.com/courses/python-repl/"/>
      <updated>2023-05-09T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use the Python standard REPL (Read-Eval-Print Loop) to run your code interactively. This tool will allow you to test new ideas, explore and experiment with new tools and libraries, refactor and debug your code, try out examples, and more.</summary>
      <content type="html">
        &lt;p&gt;The Python standard shell, or &lt;strong&gt;REPL (Read-Eval-Print Loop)&lt;/strong&gt;, allows you to run Python code interactively while working on a project or learning the language. This tool is available in every Python installation, so you can use it at any moment.&lt;/p&gt;
&lt;p&gt;As a Python developer, you&amp;rsquo;ll spend a considerable part of your coding time in a REPL session because this tool allows you to test new ideas, explore and experiment with new tools and libraries, refactor and debug your code, and try out examples.&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;Run the Python &lt;strong&gt;standard REPL&lt;/strong&gt;, or interactive shell&lt;/li&gt;
&lt;li&gt;Write and execute &lt;strong&gt;Python code&lt;/strong&gt; in an interactive session&lt;/li&gt;
&lt;li&gt;Quickly &lt;strong&gt;edit&lt;/strong&gt;, &lt;strong&gt;modify&lt;/strong&gt;, and &lt;strong&gt;reuse&lt;/strong&gt; code in a REPL session&lt;/li&gt;
&lt;li&gt;Get &lt;strong&gt;help&lt;/strong&gt; and &lt;strong&gt;introspect&lt;/strong&gt; your code in an interactive session&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tweak&lt;/strong&gt; some features of the standard REPL&lt;/li&gt;
&lt;li&gt;Identify the standard REPL&amp;rsquo;s &lt;strong&gt;missing features&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll also learn about available feature-rich REPLs, such as &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt;, &lt;a href=&quot;https://ipython.readthedocs.io/en/stable/#ipython-documentation&quot;&gt;IPython&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/bpython-alternative-python-repl/&quot;&gt;bpython&lt;/a&gt;, and &lt;a href=&quot;https://github.com/jonathanslenders/ptpython/&quot;&gt;ptpython&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To get the most out of this video course, you should be familiar with your operating system&amp;rsquo;s command line, or terminal. You should also know the basics of using the &lt;a href=&quot;https://realpython.com/courses/command-line-interfaces/&quot;&gt;&lt;code&gt;python&lt;/code&gt; command&lt;/a&gt; to run 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>The Real Python Podcast – Episode #155: Checking Project Dependencies &amp; Python Dev Resource Collections</title>
      <id>https://realpython.com/podcasts/rpp/155/</id>
      <link href="https://realpython.com/podcasts/rpp/155/"/>
      <updated>2023-05-05T12:00:00+00:00</updated>
      <summary>How can you ensure that you&#x27;ve appropriately declared your project&#x27;s required dependencies? How do you determine what dependencies are missing from a third-party project that you can&#x27;t run? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;How can you ensure that you&#x27;ve appropriately declared your project&#x27;s required dependencies? How do you determine what dependencies are missing from a third-party project that you can&#x27;t run? This week on the show, Christopher Trudeau is here, 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>Publishing Python Packages to PyPI</title>
      <id>https://realpython.com/courses/pypi-publish-python-package/</id>
      <link href="https://realpython.com/courses/pypi-publish-python-package/"/>
      <updated>2023-05-02T14:00:00+00:00</updated>
      <summary>In this video course, you’ll learn how to create a Python package for your project and how to publish it to PyPI, the Python Package Index. Quickly get up to speed on everything from naming your package to configuring it using setup.cfg.</summary>
      <content type="html">
        &lt;p&gt;&lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt; is the public hosting service where open-source Python packages live.
When you &lt;code&gt;pip install&lt;/code&gt; a package, that&amp;rsquo;s where it fetches it from. In this course,
you&amp;rsquo;ll learn all about the structures of a package and how to upload your own
to the PyPI server.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why &lt;strong&gt;packages&lt;/strong&gt; and &lt;strong&gt;virtual environments&lt;/strong&gt; exist&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;structure&lt;/strong&gt; a package&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;build systems&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;The contents of the &lt;strong&gt;&lt;code&gt;pyproject.toml&lt;/code&gt; file&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to use the &lt;strong&gt;&lt;code&gt;build&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;twine&lt;/code&gt;&lt;/strong&gt; tools&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;Flit&lt;/strong&gt; and &lt;strong&gt;Poetry&lt;/strong&gt; tools offer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Throughout this course, you&amp;rsquo;ll work with an example project: a &lt;code&gt;reader&lt;/code&gt; package that can be used to read Real Python tutorials in your console.&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 #154: Targeting WebAssembly Platforms &amp; Distilling a Minimum Viable Python</title>
      <id>https://realpython.com/podcasts/rpp/154/</id>
      <link href="https://realpython.com/podcasts/rpp/154/"/>
      <updated>2023-04-28T12:00:00+00:00</updated>
      <summary>Are you familiar with the different versions of WebAssembly? Could WASM be the &quot;write once, run everywhere&quot; solution that developers have searched for? Where does distributing Python applications fit in the narrative? This week on the show, we have CPython core developer Brett Cannon to discuss his recent articles about WebAssembly and MVPy.</summary>
      <content type="html">
        &lt;p&gt;Are you familiar with the different versions of WebAssembly? Could WASM be the &quot;write once, run everywhere&quot; solution that developers have searched for? Where does distributing Python applications fit in the narrative? This week on the show, we have CPython core developer Brett Cannon to discuss his recent articles about WebAssembly and MVPy.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using Python&#x27;s assert to Debug and Test Your Code</title>
      <id>https://realpython.com/courses/python-assert-statement/</id>
      <link href="https://realpython.com/courses/python-assert-statement/"/>
      <updated>2023-04-25T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to use Python&#x27;s assert statement to document, debug, and test code in development. You&#x27;ll learn how assertions might be disabled in production code, so you shouldn&#x27;t use them to validate data. You&#x27;ll also learn about a few common pitfalls of assertions in Python.</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s &lt;code&gt;assert&lt;/code&gt; statement allows you to write &lt;a href=&quot;https://en.wikipedia.org/wiki/Sanity_check&quot;&gt;sanity checks&lt;/a&gt; in your code. These checks are known as &lt;strong&gt;assertions&lt;/strong&gt;, and you can use them to test if certain assumptions remain true while you&amp;rsquo;re developing your code. If any of your assertions turn false, then you have a bug in your code.&lt;/p&gt;
&lt;p&gt;Assertions are a convenient tool for &lt;strong&gt;documenting&lt;/strong&gt;, &lt;strong&gt;debugging&lt;/strong&gt;, and &lt;strong&gt;testing&lt;/strong&gt; code during development. Once you&amp;rsquo;ve debugged and tested your code with the help of assertions, then you can turn them off to optimize the code for production. Assertions will help you make your code more efficient, robust, and reliable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;assertions&lt;/strong&gt; are and when to use them&lt;/li&gt;
&lt;li&gt;How Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;assert&lt;/code&gt; statement&lt;/strong&gt; works&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;assert&lt;/code&gt; can help you &lt;strong&gt;document&lt;/strong&gt;, &lt;strong&gt;debug&lt;/strong&gt;, and &lt;strong&gt;test&lt;/strong&gt; your code&lt;/li&gt;
&lt;li&gt;How assertions can be &lt;strong&gt;disabled&lt;/strong&gt; to improve performance in production&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;common pitfalls&lt;/strong&gt; you might face when using &lt;code&gt;assert&lt;/code&gt; statements&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this video course, you should have previous knowledge of &lt;a href=&quot;https://realpython.com/python-operators-expressions/&quot;&gt;expressions and operators&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-exceptions/&quot;&gt;exceptions&lt;/a&gt;. Having a basic understanding of &lt;a href=&quot;https://realpython.com/documenting-python-code/&quot;&gt;documenting&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-debugging-pdb/&quot;&gt;debugging&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;testing&lt;/a&gt; Python code is also a plus.&lt;/p&gt;
        &lt;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 Basics: Installing Packages With pip</title>
      <id>https://realpython.com/courses/python-pip-install/</id>
      <link href="https://realpython.com/courses/python-pip-install/"/>
      <updated>2023-04-18T14:00:00+00:00</updated>
      <summary>Python&#x27;s standard library includes a whole buffet of useful packages, but sometimes you need to reach for a third-party library. That&#x27;s where pip comes in handy. In this video course, you&#x27;ll learn how to pip install packages.</summary>
      <content type="html">
        &lt;p&gt;So far on the &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics learning path&lt;/a&gt;, you&amp;rsquo;ve been working within the bounds of the Python standard library. Now it&amp;rsquo;s time to unlock packages that aren&amp;rsquo;t included with Python by default. To do that, you&amp;rsquo;ll need &lt;strong&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Many programming languages offer a &lt;strong&gt;package manager&lt;/strong&gt; that automates the process of installing, upgrading, and removing &lt;strong&gt;third-party packages&lt;/strong&gt;. Python is no exception. The de facto package manager for Python is called &lt;code&gt;pip&lt;/code&gt;. &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;Install&lt;/strong&gt; and &lt;strong&gt;manage&lt;/strong&gt; third-party packages with &lt;code&gt;pip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;virtual environments&lt;/strong&gt; to separate project dependencies&lt;/li&gt;
&lt;li&gt;Declare &lt;strong&gt;requirements&lt;/strong&gt; and &lt;strong&gt;re-create&lt;/strong&gt; a development environment&lt;/li&gt;
&lt;li&gt;Navigate &lt;strong&gt;PyPI&lt;/strong&gt;, the Python Package Index&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With that knowledge as your guide, you&amp;rsquo;ll be able to confidently install packages to suit your programming needs.&lt;/p&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #153: Seeking Faster Text Processing &amp; Python&#x27;s .__repr__() vs .__str__()</title>
      <id>https://realpython.com/podcasts/rpp/153/</id>
      <link href="https://realpython.com/podcasts/rpp/153/"/>
      <updated>2023-04-14T12:00:00+00:00</updated>
      <summary>What can you do if your text manipulation in Python is slowing you down? Are there faster alternatives using a compiled extension? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What can you do if your text manipulation in Python is slowing you down? Are there faster alternatives using a compiled extension? This week on the show, Christopher Trudeau is here, 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>Using OrderedDict in Python</title>
      <id>https://realpython.com/courses/ordereddict-python/</id>
      <link href="https://realpython.com/courses/ordereddict-python/"/>
      <updated>2023-04-11T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn what Python&#x27;s OrderedDict is and how to use it in your code. You&#x27;ll also learn about the main differences between regular dictionaries and ordered dictionaries.</summary>
      <content type="html">
        &lt;p&gt;Sometimes you need a Python &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt; that remembers the order of its items. In the past, you had only one tool for solving this specific problem: Python&amp;rsquo;s &lt;a href=&quot;https://docs.python.org/3/library/collections.html#collections.OrderedDict&quot;&gt;&lt;code&gt;OrderedDict&lt;/code&gt;&lt;/a&gt;. It&amp;rsquo;s a dictionary subclass specially designed to remember the order of items, which is defined by the insertion order of keys.&lt;/p&gt;
&lt;p&gt;This changed in Python 3.6. The built-in &lt;code&gt;dict&lt;/code&gt; class now keeps its items ordered as well. Because of that, many in the Python community now wonder if &lt;code&gt;OrderedDict&lt;/code&gt; is still useful. A closer look at &lt;code&gt;OrderedDict&lt;/code&gt; will uncover that this class still provides valuable features.&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 and use &lt;strong&gt;&lt;code&gt;OrderedDict&lt;/code&gt; objects&lt;/strong&gt; in your code&lt;/li&gt;
&lt;li&gt;Identify the &lt;strong&gt;differences&lt;/strong&gt; between &lt;code&gt;OrderedDict&lt;/code&gt; and &lt;code&gt;dict&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;pros&lt;/strong&gt; and &lt;strong&gt;cons&lt;/strong&gt; of using &lt;code&gt;OrderedDict&lt;/code&gt; vs &lt;code&gt;dict&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With this knowledge, you&amp;rsquo;ll able to choose the dictionary class that best fits your needs when you want to preserve the order of items.&lt;/p&gt;
&lt;p&gt;By the end of the course, you&amp;rsquo;ll see an example of implementing a dictionary-based queue using &lt;code&gt;OrderedDict&lt;/code&gt;, which would be more challenging if you used a regular &lt;code&gt;dict&lt;/code&gt; object.&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 #152: Automate Processes and Distribute Python Tools With RPA and RCC</title>
      <id>https://realpython.com/podcasts/rpp/152/</id>
      <link href="https://realpython.com/podcasts/rpp/152/"/>
      <updated>2023-04-07T12:00:00+00:00</updated>
      <summary>Are you exploring automation of your repetitive business tasks with Python? How are you going to share your helpful tools with co-workers? This week on the show, Sampo Ahokas from Robocorp is here to discuss robotic process automation (RPA) and distribution of these robots.</summary>
      <content type="html">
        &lt;p&gt;Are you exploring automation of your repetitive business tasks with Python? How are you going to share your helpful tools with co-workers? This week on the show, Sampo Ahokas from Robocorp is here to discuss robotic process automation (RPA) and distribution of these robots.&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 #151: Evaluating Python Packages &amp; Celebrating 20 Years of PyCon US</title>
      <id>https://realpython.com/podcasts/rpp/151/</id>
      <link href="https://realpython.com/podcasts/rpp/151/"/>
      <updated>2023-03-31T12:00:00+00:00</updated>
      <summary>Have you ever installed a Python package without knowing anything about it? What best practices should you employ to ensure the quality of your next package installation? Christopher Trudeau is back this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects. We also have Python Software Foundation executive director, Deb Nicholson, to share details about PyCon US 2023.</summary>
      <content type="html">
        &lt;p&gt;Have you ever installed a Python package without knowing anything about it? What best practices should you employ to ensure the quality of your next package installation? Christopher Trudeau is back this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects. We also have Python Software Foundation executive director, Deb Nicholson, to share details about PyCon US 2023.&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>
