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

  
    <entry>
      <title>The Real Python Podcast – Episode #24: Options for Packaging Your Python Application: Wheels, Docker, and More</title>
      <id>https://realpython.com/podcasts/rpp/24/</id>
      <link href="https://realpython.com/podcasts/rpp/24/"/>
      <updated>2020-08-28T12:00:00+00:00</updated>
      <summary>Have you wondered, how should I package my Python code? You&#x27;ve written the application, but now you need to distribute it to the machines it&#x27;s intended to run on. It depends on what the code is, the libraries it depends on, and with whom do you want to share it. This week on the show we have Itamar Turner-Trauring, creator of the website pythonspeed.com. We discuss his article &quot;Options for Packaging Your Python Code: Wheels, Conda, Docker, and More,&quot; covering the how of sharing your code.</summary>
      <content type="html">
        &lt;p&gt;Have you wondered, how should I package my Python code? You&#x27;ve written the application, but now you need to distribute it to the machines it&#x27;s intended to run on. It depends on what the code is, the libraries it depends on, and with whom do you want to share it. This week on the show we have Itamar Turner-Trauring, creator of the website pythonspeed.com. We discuss his article &quot;Options for Packaging Your Python Code: Wheels, Conda, Docker, and More,&quot; covering the how of sharing 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>Common Python Data Structures (Guide)</title>
      <id>https://realpython.com/python-data-structures/</id>
      <link href="https://realpython.com/python-data-structures/"/>
      <updated>2020-08-26T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about Python&#x27;s data structures. You&#x27;ll look at several implementations of abstract data types and learn which implementations are best for your specific use cases.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Data structures&lt;/strong&gt; are the fundamental constructs around which you build your programs. Each data structure provides a particular way of organizing data so it can be accessed efficiently, depending on your use case. Python ships with an extensive set of data structures in its &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;However, Python’s naming convention doesn’t provide the same level of clarity that you’ll find in other languages. In Java, a list isn’t just a &lt;code&gt;list&lt;/code&gt;—it’s  either a &lt;code&gt;LinkedList&lt;/code&gt; or an &lt;code&gt;ArrayList&lt;/code&gt;. Not so in Python. Even experienced Python developers sometimes wonder whether the built-in &lt;code&gt;list&lt;/code&gt; type is implemented as a &lt;a href=&quot;https://realpython.com/linked-lists-python/&quot;&gt;linked list&lt;/a&gt; or a dynamic array. &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;Which common &lt;strong&gt;abstract data types&lt;/strong&gt; are built into the Python standard library&lt;/li&gt;
&lt;li&gt;How the most common abstract data types map to Python’s &lt;strong&gt;naming scheme&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to put abstract data types to &lt;strong&gt;practical use&lt;/strong&gt; in various algorithms&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This tutorial is adapted from the chapter “Common Data Structures in Python” in &lt;a href=&quot;https://realpython.com/products/python-tricks-book/&quot;&gt;&lt;em&gt;Python Tricks: The Book&lt;/em&gt;&lt;/a&gt;. If you enjoy what you read below, then be sure to check out &lt;a href=&quot;https://realpython.com/products/python-tricks-book/&quot;&gt;the rest of the book&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-tricks-sample-pdf/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-tricks-sample-pdf&quot; data-focus=&quot;false&quot;&gt;Get a sample chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python&#x27;s best practices with simple examples you can apply instantly to write more beautiful + Pythonic code.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;dictionaries-maps-and-hash-tables&quot;&gt;Dictionaries, Maps, and Hash Tables&lt;/h2&gt;
&lt;p&gt;In Python, &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt; (or &lt;strong&gt;dicts&lt;/strong&gt; for short) are a central data structure. Dicts store an arbitrary number of objects, each identified by a unique dictionary &lt;strong&gt;key&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Dictionaries are also often called &lt;strong&gt;maps&lt;/strong&gt;, &lt;strong&gt;hashmaps&lt;/strong&gt;, &lt;strong&gt;lookup tables&lt;/strong&gt;, or &lt;strong&gt;associative arrays&lt;/strong&gt;. They allow for the efficient lookup, insertion, and deletion of any object associated with a given key.&lt;/p&gt;
&lt;p&gt;Phone books make a decent real-world analog for dictionary objects. They allow you to quickly retrieve the information (phone number) associated with a given key (a person’s name). Instead of having to read a phone book front to back to find someone’s number, you can jump more or less directly to a name and look up the associated information.&lt;/p&gt;
&lt;p&gt;This analogy breaks down somewhat when it comes to &lt;em&gt;how&lt;/em&gt; the information is organized to allow for fast lookups. But the fundamental performance characteristics hold. Dictionaries allow you to quickly find the information associated with a given key.&lt;/p&gt;
&lt;p&gt;Dictionaries are one of the most important and frequently used data structures in computer science. So, how does Python handle dictionaries? Let’s take a tour of the dictionary implementations available in core Python and the Python standard library.&lt;/p&gt;
&lt;h3 id=&quot;dict-your-go-to-dictionary&quot;&gt;&lt;code&gt;dict&lt;/code&gt;: Your Go-To Dictionary&lt;/h3&gt;
&lt;p&gt;Because dictionaries are so important, Python features a robust dictionary implementation that’s built directly into the core language: the &lt;a href=&quot;https://docs.python.org/3/library/stdtypes.html#mapping-types-dict&quot;&gt;&lt;code&gt;dict&lt;/code&gt;&lt;/a&gt; data type.&lt;/p&gt;
&lt;p&gt;Python also provides some useful &lt;strong&gt;syntactic sugar&lt;/strong&gt; for working with dictionaries in your programs. For example, the curly-brace ({ }) dictionary expression syntax and &lt;a href=&quot;https://realpython.com/iterate-through-dictionary-python/#using-comprehensions&quot;&gt;dictionary comprehensions&lt;/a&gt; allow you to conveniently define new dictionary objects:&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;phonebook&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;bob&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7387&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;alice&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3719&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;jack&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7052&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;squares&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;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&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;phonebook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;alice&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3719&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;squares&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;There are some restrictions on which objects can be used as valid keys.&lt;/p&gt;
&lt;p&gt;Python’s dictionaries are indexed by keys that can be of any &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-hashable&quot;&gt;hashable&lt;/a&gt; type. A &lt;strong&gt;hashable&lt;/strong&gt; object has a hash value that never changes during its lifetime (see &lt;code&gt;__hash__&lt;/code&gt;), and it can be compared to other objects (see &lt;code&gt;__eq__&lt;/code&gt;). Hashable objects that compare as equal must have the same hash value.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/courses/immutability-python/&quot;&gt;&lt;strong&gt;Immutable&lt;/strong&gt; types&lt;/a&gt; like &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;numbers&lt;/a&gt; are hashable and work well as dictionary keys. You can also use &lt;a href=&quot;https://realpython.com/python-lists-tuples/#python-tuples&quot;&gt;&lt;code&gt;tuple&lt;/code&gt; objects&lt;/a&gt; as dictionary keys as long as they contain only hashable types themselves.&lt;/p&gt;
&lt;p&gt;For most use cases, Python’s built-in dictionary implementation will do everything you need. Dictionaries are highly optimized and underlie many parts of the language. For example, &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#class-and-instance-attributes-scope&quot;&gt;class attributes&lt;/a&gt; and variables in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Call_stack#Structure&quot;&gt;stack frame&lt;/a&gt; are both stored internally in dictionaries.&lt;/p&gt;
&lt;p&gt;Python dictionaries are based on a well-tested and finely tuned hash table implementation that provides the performance characteristics you’d expect: &lt;em&gt;O&lt;/em&gt;(1) time complexity for lookup, insert, update, and delete operations in the average case.&lt;/p&gt;
&lt;p&gt;There’s little reason not to use the standard &lt;code&gt;dict&lt;/code&gt; implementation included with Python. However, specialized third-party dictionary implementations exist, such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Skip_list&quot;&gt;skip lists&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/B-tree&quot;&gt;B-tree–based&lt;/a&gt; dictionaries.&lt;/p&gt;
&lt;p&gt;Besides plain &lt;code&gt;dict&lt;/code&gt; objects, Python’s standard library also includes a number of specialized dictionary implementations. These specialized dictionaries are all based on the built-in dictionary class (and share its performance characteristics) but also include some additional convenience features.&lt;/p&gt;
&lt;p&gt;Let’s take a look at them.&lt;/p&gt;
&lt;h3 id=&quot;collectionsordereddict-remember-the-insertion-order-of-keys&quot;&gt;&lt;code&gt;collections.OrderedDict&lt;/code&gt;: Remember the Insertion Order of Keys&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-data-structures/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-data-structures/ »&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>Django Redirects</title>
      <id>https://realpython.com/courses/django-redirects/</id>
      <link href="https://realpython.com/courses/django-redirects/"/>
      <updated>2020-08-25T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn everything you need to know about HTTP redirects in Django. All the way from the low-level details of the HTTP protocol to the high-level way of dealing with them in Django.</summary>
      <content type="html">
        &lt;p&gt;When you build web applications in Python using the &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;Django framework&lt;/a&gt;, you&amp;rsquo;ll likely need to redirect the user from one URL to another. This course covers what you need to know about redirecting in Django. All the way from the low-level details of the HTTP protocol to the high-level way of dealing with them in Django.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How &lt;strong&gt;HTTP Redirects&lt;/strong&gt; work&lt;/li&gt;
&lt;li&gt;The difference between &lt;strong&gt;temporary&lt;/strong&gt; and &lt;strong&gt;permanent&lt;/strong&gt; redirects&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;query strings&lt;/strong&gt; with a redirect&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;avoid common problems&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python mmap: Improved File I/O With Memory Mapping</title>
      <id>https://realpython.com/python-mmap/</id>
      <link href="https://realpython.com/python-mmap/"/>
      <updated>2020-08-24T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use Python&#x27;s mmap module to improve your code&#x27;s performance when you&#x27;re working with files. You&#x27;ll get a quick overview of the different types of memory before diving into how and why memory mapping with mmap can make your file I/O operations faster.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;a href=&quot;https://www.python.org/dev/peps/pep-0020/&quot;&gt;Zen of Python&lt;/a&gt; has a lot of wisdom to offer. One especially useful idea is that “There should be one—and preferably only one—obvious way to do it.” Yet there are multiple ways to do most things in Python, and often for good reason. For example, there are &lt;a href=&quot;https://realpython.com/read-write-files-python/&quot;&gt;multiple ways to read a file in Python&lt;/a&gt;, including the rarely used &lt;code&gt;mmap&lt;/code&gt; module &lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;mmap&lt;/code&gt; provides memory-mapped file input and output (I/O). It allows you to take advantage of lower-level operating system functionality to read files as if they were one large &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt; or &lt;a href=&quot;https://dbader.org/blog/python-arrays&quot;&gt;array&lt;/a&gt;. This can provide significant performance improvements in code that requires a lot of file I/O.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What kinds of &lt;strong&gt;computer memory&lt;/strong&gt; exist&lt;/li&gt;
&lt;li&gt;What problems you can solve with &lt;strong&gt;&lt;code&gt;mmap&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How use memory mapping to &lt;strong&gt;read large files faster&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to change a &lt;strong&gt;portion of a file&lt;/strong&gt; without rewriting the entire file&lt;/li&gt;
&lt;li&gt;How to use &lt;code&gt;mmap&lt;/code&gt; to &lt;strong&gt;share information&lt;/strong&gt; between multiple processes&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/cpython-internals-sample/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-cpython-internals-sample&quot; data-focus=&quot;false&quot;&gt;Get a sample chapter from CPython Internals: Your Guide to the Python 3 Interpreter&lt;/a&gt; showing you how to unlock the inner workings of the Python language, compile the Python interpreter from source  code, and participate in the development of CPython.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;understanding-computer-memory&quot;&gt;Understanding Computer Memory&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Memory mapping&lt;/strong&gt; is a technique that uses lower-level operating system APIs to load a file directly into computer memory. It can dramatically improve file I/O performance in your program. To better understand how memory mapping improves performance, as well as how and when you can use the &lt;code&gt;mmap&lt;/code&gt; module to take advantage of these performance benefits, it’s useful to first learn a bit about computer memory.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Computer_memory&quot;&gt;Computer memory&lt;/a&gt; is a big, complicated topic, but this tutorial focuses only on what you need to know to use the &lt;code&gt;mmap&lt;/code&gt; module effectively. For the purposes of this tutorial, the term &lt;strong&gt;memory&lt;/strong&gt; refers to &lt;a href=&quot;https://en.wikipedia.org/wiki/Random-access_memory&quot;&gt;random-access memory&lt;/a&gt;, or RAM.&lt;/p&gt;
&lt;p&gt;There are several types of computer memory:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Physical&lt;/li&gt;
&lt;li&gt;Virtual&lt;/li&gt;
&lt;li&gt;Shared&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Each type of memory can come into play when you’re using memory mapping, so let’s review each one from a high level.&lt;/p&gt;
&lt;h3 id=&quot;physical-memory&quot;&gt;Physical Memory&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Physical memory&lt;/strong&gt; is the least complicated type of memory to understand because it’s often part of the marketing associated with your computer. (You might remember that when you bought your computer, it advertised something like 8 gigabytes of RAM.) Physical memory typically comes on cards that are connected to your computer’s motherboard.&lt;/p&gt;
&lt;p&gt;Physical memory is the amount of &lt;a href=&quot;https://en.wikipedia.org/wiki/Volatile_memory&quot;&gt;volatile memory&lt;/a&gt; that’s available for your programs to use while running. Physical memory should not be confused with storage, such as your hard drive or solid-state disk.&lt;/p&gt;
&lt;h3 id=&quot;virtual-memory&quot;&gt;Virtual Memory&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Virtual_memory&quot;&gt;Virtual memory&lt;/a&gt; is a way of handling &lt;a href=&quot;https://realpython.com/python-memory-management/&quot;&gt;memory management&lt;/a&gt;. The operating system uses virtual memory to make it appear that you have more memory than you do, allowing you to worry less about how much memory is available for your programs at any given time. Behind the scenes, your operating system uses parts of your nonvolatile storage, such as your solid-state disk, to simulate additional RAM.&lt;/p&gt;
&lt;p&gt;In order to do this, your operating system must maintain a mapping between physical memory and virtual memory. Each operating system uses its own sophisticated algorithm to map virtual memory addresses to physical ones using a data structure called a &lt;a href=&quot;https://en.wikipedia.org/wiki/Page_table&quot;&gt;page table&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Luckily, most of this complication is hidden from your programs. You don’t need to understand page tables or logical-to-physical mapping to write performant I/O code in Python. However, knowing a little bit about memory gives you a better understanding of what the computer and libraries are taking care of for you.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mmap&lt;/code&gt; uses virtual memory to make it appear that you’ve loaded a very large file into memory, even if the contents of the file are too big to fit in your physical memory.&lt;/p&gt;
&lt;h3 id=&quot;shared-memory&quot;&gt;Shared Memory&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Shared_memory&quot;&gt;Shared memory&lt;/a&gt; is another technique provided by your operating system that allows multiple programs to access the same data simultaneously. Shared memory can be a very efficient way of handling data in a program that uses &lt;a href=&quot;https://realpython.com/python-concurrency/&quot;&gt;concurrency&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;mmap&lt;/code&gt; uses  shared memory to efficiently share large amounts of data between multiple Python processes, &lt;a href=&quot;https://realpython.com/intro-to-python-threading/&quot;&gt;threads&lt;/a&gt;, and tasks that are happening concurrently.&lt;/p&gt;
&lt;h2 id=&quot;digging-deeper-into-file-io&quot;&gt;Digging Deeper Into File I/O&lt;/h2&gt;
&lt;p&gt;Now that you have a high-level view of the different types of memory, it’s time to understand what memory mapping is and what problems it solves. Memory mapping is another way to perform file I/O that can result in better performance and memory efficiency.&lt;/p&gt;
&lt;p&gt;In order to fully appreciate what memory mapping does, it’s useful to consider regular file I/O from a lower-level perspective. A lot of things happen behind the scenes when reading a file:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-mmap/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-mmap/ »&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 #23: Python Wheels and Pass by Reference in Python</title>
      <id>https://realpython.com/podcasts/rpp/23/</id>
      <link href="https://realpython.com/podcasts/rpp/23/"/>
      <updated>2020-08-21T12:00:00+00:00</updated>
      <summary>Have you wondered what are Python wheels? How are they used to package Python code? Does Python use pass by value or pass by reference? This week on the show, David Amos is here to help answer these questions, and he has brought another batch of PyCoder’s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you wondered what are Python wheels? How are they used to package Python code? Does Python use pass by value or pass by reference? This week on the show, David Amos is here to help answer these questions, and he has brought another batch of PyCoder’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>Data Version Control With Python and DVC</title>
      <id>https://realpython.com/python-data-version-control/</id>
      <link href="https://realpython.com/python-data-version-control/"/>
      <updated>2020-08-19T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn to use DVC, a powerful tool that solves many problems encountered in machine learning and data science. You&#x27;ll find out how data version control helps you to track your data, share development machines with your team, and create easily reproducible experiments!</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Machine learning and data science come with a set of problems that are different from what you’ll find in traditional software engineering. Version control systems help developers manage changes to source code. But data version control, managing changes to &lt;strong&gt;models&lt;/strong&gt; and &lt;strong&gt;datasets&lt;/strong&gt;, isn’t so well established.&lt;/p&gt;
&lt;p&gt;It’s not easy to keep track of all the data you use for experiments and the models you produce. Accurately &lt;strong&gt;reproducing experiments&lt;/strong&gt; that you or others have done is a challenge. Many teams are actively developing tools and frameworks to solve these problems.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use a tool called &lt;strong&gt;DVC&lt;/strong&gt; to tackle some of these challenges&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Track and version&lt;/strong&gt; your datasets and models&lt;/li&gt;
&lt;li&gt;Share a &lt;strong&gt;single development computer&lt;/strong&gt; between teammates&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;reproducible&lt;/strong&gt; machine learning experiments&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial includes several examples of data version control techniques in action. To follow along, you can get the repository with the sample code by clicking the following link:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Get the Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/data-version-control-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-data-version-control-code&quot; data-focus=&quot;false&quot;&gt;Click here to get the source code you&#x27;ll use&lt;/a&gt; to learn about data version control with DVC in this tutorial.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;what-is-data-version-control&quot;&gt;What Is Data Version Control?&lt;/h2&gt;
&lt;p&gt;In standard software engineering, many people need to work on a shared codebase and handle multiple versions of the same code. This can quickly lead to confusion and costly mistakes. &lt;/p&gt;
&lt;p&gt;To address this problem, developers use &lt;strong&gt;version control systems&lt;/strong&gt;, such as &lt;a href=&quot;https://git-scm.com/&quot;&gt;Git&lt;/a&gt;, that help keep team members organized.&lt;/p&gt;
&lt;p&gt;In a version control system, there’s a central repository of code that represents the current, official state of the project. A developer can make a copy of that project, make some changes, and request that their new version become the official one. Their code is then reviewed and tested before it’s deployed to production. &lt;/p&gt;
&lt;p&gt;These quick feedback cycles can happen many times per day in traditional development projects. But similar conventions and standards are largely missing from commercial data science and machine learning. &lt;strong&gt;Data version control&lt;/strong&gt; is a set of tools and processes that tries to adapt the version control process to the data world.&lt;/p&gt;
&lt;p&gt;Having systems in place that allow people to work quickly and pick up where others have left off would increase the speed and quality of delivered results. It would enable people to manage data transparently, run experiments effectively, and collaborate with others. &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; An &lt;strong&gt;experiment&lt;/strong&gt; in this context means either training a model or running operations on a dataset to learn something from it.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;One tool that helps researchers govern their data and models and run reproducible experiments is &lt;strong&gt;DVC&lt;/strong&gt;, which stands for &lt;strong&gt;Data Version Control&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&quot;what-is-dvc&quot;&gt;What Is DVC?&lt;/h2&gt;
&lt;p&gt;DVC is a command-line tool written in Python. It mimics Git commands and workflows to ensure that users can quickly incorporate it into their regular Git practice. If you haven’t worked with Git before, then be sure to check out &lt;a href=&quot;https://realpython.com/python-git-github-intro&quot;&gt;Introduction to Git and GitHub for Python Developers&lt;/a&gt;. If you’re familiar with Git but would like to take your skills to the next level, then check out &lt;a href=&quot;https://realpython.com/advanced-git-for-pythonistas/&quot;&gt;Advanced Git Tips for Python Developers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;DVC is meant to be run alongside Git. In fact, the &lt;code&gt;git&lt;/code&gt; and &lt;code&gt;dvc&lt;/code&gt; commands will often be used in tandem, one after the other. While Git is used to store and version code, DVC does the same for data and model files. &lt;/p&gt;
&lt;p&gt;Git can store code locally and also on a hosting service like &lt;a href=&quot;https://github.com/&quot;&gt;GitHub&lt;/a&gt;, &lt;a href=&quot;https://bitbucket.org/&quot;&gt;Bitbucket&lt;/a&gt;, or &lt;a href=&quot;https://about.gitlab.com/&quot;&gt;GitLab&lt;/a&gt;. Likewise, DVC uses a remote repository to store all your data and models. This is the single source of truth, and it can be shared amongst the whole team. You can get a local copy of the remote repository, modify the files, then upload your changes to share with team members.&lt;/p&gt;
&lt;p&gt;The remote repository can be on the same computer you’re working on, or it can be in the cloud. DVC supports most major cloud providers, including &lt;a href=&quot;https://aws.amazon.com/about-aws/&quot;&gt;AWS&lt;/a&gt;, &lt;a href=&quot;https://cloud.google.com/&quot;&gt;GCP&lt;/a&gt;, and &lt;a href=&quot;https://azure.microsoft.com/en-us/overview/what-is-azure/&quot;&gt;Azure&lt;/a&gt;. But you can set up a DVC remote repository on any server and connect it to your laptop. There are safeguards to keep members from corrupting or deleting the remote data.&lt;/p&gt;
&lt;p&gt;When you store your data and models in the remote repository, a &lt;strong&gt;&lt;code&gt;.dvc&lt;/code&gt; file&lt;/strong&gt; is created. A &lt;code&gt;.dvc&lt;/code&gt; file is a small text file that points to your actual data files in remote storage. &lt;/p&gt;
&lt;p&gt;The &lt;code&gt;.dvc&lt;/code&gt; file is lightweight and meant to be stored with your code in GitHub. When you download a Git repository, you also get the &lt;code&gt;.dvc&lt;/code&gt; files. You can then use those files to get the data associated with that repository. Large data and model files go in your DVC remote storage, and small &lt;code&gt;.dvc&lt;/code&gt; files that point to your data go in GitHub. &lt;/p&gt;
&lt;p&gt;The best way to understand DVC is to use it, so let’s dive in. You’ll explore the most important features by working through several examples. Before you start, you’ll need to set up an environment to work in and then get some data.&lt;/p&gt;
&lt;h2 id=&quot;set-up-your-working-environment&quot;&gt;Set Up Your Working Environment&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll learn how to use DVC by practicing on examples that work with image data. You’ll play around with lots of image files and train a machine learning model that recognizes what an image contains.&lt;/p&gt;
&lt;p&gt;To work through the examples, you’ll need to have Python and Git installed on your system. You can follow the &lt;a href=&quot;https://realpython.com/installing-python/&quot;&gt;Python 3 Installation and Setup Guide&lt;/a&gt; to install Python on your system. To install Git, you can read through &lt;a href=&quot;https://git-scm.com/book/en/v2/Getting-Started-Installing-Git&quot;&gt;Installing Git&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-data-version-control/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-data-version-control/ »&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>Real Python Office Hours</title>
      <id>https://realpython.com/courses/office-hours/</id>
      <link href="https://realpython.com/courses/office-hours/"/>
      <updated>2020-08-18T14:00:00+00:00</updated>
      <summary>The Real Python Office Hours is a weekly hangout where members of Real Python get the chance to interact with each other as well as Real Python authors and video course instructors. Join us live on Wednesday mornings!</summary>
      <content type="html">
        &lt;p&gt;The &lt;a href=&quot;https://realpython.com/office-hours&quot;&gt;Real Python Office Hours&lt;/a&gt; is a weekly hangout where members of Real Python get the chance to meet fellow Pythonistas to chat about your learning progress, ask questions, and discuss Python tips &amp;amp; tricks via screen sharing.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you can:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;View previous office hours meetings&lt;/li&gt;
&lt;li&gt;Download the chat transcript from each meeting&lt;/li&gt;
&lt;li&gt;Explore resources and bonus materials discussed during each meeting&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Office Hours Schedule &amp;amp; Registration:&lt;/strong&gt; Join us live for the next members-only Q&amp;amp;A session with the Real Python Team: &lt;a href=&quot;https://realpython.com/office-hours/&quot;&gt;View upcoming Office Hours events »&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>A Practical Introduction to Web Scraping in Python</title>
      <id>https://realpython.com/python-web-scraping-practical-introduction/</id>
      <link href="https://realpython.com/python-web-scraping-practical-introduction/"/>
      <updated>2020-08-17T16:11:05+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn all about web scraping in Python. You&#x27;ll see how to parse data from websites and interact with HTML forms using tools such as Beautiful Soup and MechanicalSoup.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Web scraping&lt;/strong&gt; is the process of collecting and parsing raw data from the Web, and the Python community has come up with some pretty powerful web scraping tools.&lt;/p&gt;
&lt;p&gt;The Internet hosts perhaps the greatest source of information—and misinformation—on the planet. Many disciplines, such as data science, business intelligence, and investigative reporting, can benefit enormously from collecting and analyzing data from websites. &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;Parse website data using &lt;strong&gt;string methods&lt;/strong&gt; and &lt;strong&gt;regular expressions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Parse website data using an &lt;strong&gt;HTML parser&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Interact with &lt;strong&gt;forms&lt;/strong&gt; and other website components&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This tutorial is adapted from the chapter “Interacting With the Web” 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 will see occasional references to IDLE throughout this tutorial. However, you should have no problems running the example code from the editor and environment of your choice.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-experiment&quot; data-focus=&quot;false&quot;&gt;Click here to get our free Python Cheat Sheet&lt;/a&gt; that shows you the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;scrape-and-parse-text-from-websites&quot;&gt;Scrape and Parse Text From Websites&lt;/h2&gt;
&lt;p&gt;Collecting data from websites using an automated process is known as web scraping. Some websites explicitly forbid users from scraping their data with automated tools like the ones you’ll create in this tutorial. Websites do this for two possible reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The site has a good reason to protect its data. For instance, Google Maps doesn’t let you request too many results too quickly.&lt;/li&gt;
&lt;li&gt;Making many repeated requests to a website’s server may use up bandwidth, slowing down the website for other users and potentially overloading the server such that the website stops responding entirely.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Before using your Python skills for web scraping, you should always check your target website’s acceptable use policy to see if accessing the website with automated tools is a violation of its terms of use. Legally, web scraping against the wishes of a website is very much a gray area.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Please be aware that the following techniques &lt;a href=&quot;https://en.wikipedia.org/wiki/Web_scraping#Legal_issues&quot;&gt;may be illegal&lt;/a&gt; when used on websites that prohibit web scraping.&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Let’s start by grabbing all the HTML code from a single web page. You’ll use a page on &lt;em&gt;Real Python&lt;/em&gt; that’s been set up for use with this tutorial.&lt;/p&gt;
&lt;h3 id=&quot;your-first-web-scraper&quot;&gt;Your First Web Scraper&lt;/h3&gt;
&lt;p&gt;One useful package for web scraping that you can find in Python’s &lt;a href=&quot;https://docs.python.org/3/library/&quot;&gt;standard library&lt;/a&gt; is &lt;code&gt;urllib&lt;/code&gt;, which contains tools for working with URLs. In particular, the &lt;a href=&quot;https://docs.python.org/3/library/urllib.request.html#module-urllib.request&quot;&gt;&lt;code&gt;urllib.request&lt;/code&gt;&lt;/a&gt; module contains a function called &lt;code&gt;urlopen()&lt;/code&gt; that can be used to open a URL within a program.&lt;/p&gt;
&lt;p&gt;In IDLE’s interactive window, type the following to import &lt;code&gt;urlopen()&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;urllib.request&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The web page that we’ll open is at the following URL:&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;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://olympus.realpython.org/profiles/aphrodite&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;To open the web page, pass &lt;code&gt;url&lt;/code&gt; to &lt;code&gt;urlopen()&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;n&quot;&gt;page&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;urlopen()&lt;/code&gt; returns an &lt;code&gt;HTTPResponse&lt;/code&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;page&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;http.client.HTTPResponse object at 0x105fef820&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;To extract the HTML from the page, first use the &lt;code&gt;HTTPResponse&lt;/code&gt; object’s &lt;code&gt;.read()&lt;/code&gt; method, which returns a sequence of bytes. Then use &lt;code&gt;.decode()&lt;/code&gt; to decode the bytes to a string using &lt;a href=&quot;https://realpython.com/python-encodings-guide/#unicode-vs-utf-8&quot;&gt;UTF-8&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;html_bytes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;html_bytes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;utf-8&quot;&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;Now you can print the HTML to see the contents of the web page:&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;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;title&amp;gt;Profile: Aphrodite&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;body bgcolor=&quot;yellow&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;center&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;img src=&quot;/static/aphrodite.gif&quot; /&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;h2&amp;gt;Name: Aphrodite&amp;lt;/h2&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Favorite animal: Dove&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Favorite color: Red&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hometown: Mount Olympus&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;/center&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;/html&amp;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/python-web-scraping-practical-introduction/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-web-scraping-practical-introduction/ »&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 #22: Create Cross-Platform Python GUI Apps With BeeWare</title>
      <id>https://realpython.com/podcasts/rpp/22/</id>
      <link href="https://realpython.com/podcasts/rpp/22/"/>
      <updated>2020-08-14T12:00:00+00:00</updated>
      <summary>Do you want to distribute your Python applications to other users who don&#x27;t have or even use Python? Maybe you&#x27;re interested in seeing your Python application run on iOS or Android mobile devices. This week on the show we have Russell Keith-Magee, the founder and maintainer of the BeeWare project. Russell talks about Briefcase, a tool that converts a Python application into native installers on macOS, Windows, Linux, and mobile devices.</summary>
      <content type="html">
        &lt;p&gt;Do you want to distribute your Python applications to other users who don&#x27;t have or even use Python? Maybe you&#x27;re interested in seeing your Python application run on iOS or Android mobile devices. This week on the show we have Russell Keith-Magee, the founder and maintainer of the BeeWare project. Russell talks about Briefcase, a tool that converts a Python application into native installers on macOS, Windows, Linux, and mobile devices.&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 Community Interview With Bruno Oliveira</title>
      <id>https://realpython.com/interview-bruno-oliveira/</id>
      <link href="https://realpython.com/interview-bruno-oliveira/"/>
      <updated>2020-08-12T14:00:00+00:00</updated>
      <summary>Bruno Oliveira is a core developer for pytest, the Python testing library. In this interview, we cover migrating a large codebase from C++ to Python, how to get started with pytest, and his love of Dark Souls.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Today I’m joined by &lt;a href=&quot;https://twitter.com/nicoddemus&quot;&gt;Bruno Oliveira&lt;/a&gt;, who is perhaps most well known for being a &lt;a href=&quot;https://docs.pytest.org/en/latest/&quot;&gt;&lt;code&gt;pytest&lt;/code&gt;&lt;/a&gt; core developer. In this interview, we cover migrating a large codebase from C++ to Python, how to get started with &lt;code&gt;pytest&lt;/code&gt;, and his love of Dark Souls.&lt;/p&gt;
&lt;p class=&quot;mt-5&quot;&gt;&lt;strong&gt;Ricky:&lt;/strong&gt; &lt;em&gt;Welcome to Real Python, Bruno. I’m glad you could join us. Let’s start in the same manner we do with all our guests: How’d you get into programming, and when did you start using Python?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bruno:&lt;/strong&gt; Hi, Ricky. Thanks for having me.
&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid w-25 float-right ml-3 rounded&quot; src=&quot;https://files.realpython.com/media/169037_10150092403564800_1683102_n.5fd5ba0595e8.jpg&quot; width=&quot;405&quot; height=&quot;720&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/169037_10150092403564800_1683102_n.5fd5ba0595e8.jpg&amp;amp;w=101&amp;amp;sig=128c95214cd14ed86bd6117ef756946a5e3895ac 101w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/169037_10150092403564800_1683102_n.5fd5ba0595e8.jpg&amp;amp;w=202&amp;amp;sig=e941788b0a80197ec133b319a04c016cdac8b756 202w, https://files.realpython.com/media/169037_10150092403564800_1683102_n.5fd5ba0595e8.jpg 405w&quot; sizes=&quot;75vw&quot; alt=&quot;Bruno Oliveira&quot;&gt;&lt;/p&gt;
&lt;p&gt;I started programming twenty-three years ago or so. I was just getting into computers when a friend of mine showed me this book about Visual Basic, and I was absolutely &lt;em&gt;amazed&lt;/em&gt; that you could write your own calculator. &lt;/p&gt;
&lt;p&gt;Sometime later, my dad bought me the &lt;em&gt;Delphi 3 Bible&lt;/em&gt;. I devoured that, and after a while I started to program in DirectX and make very simple games. &lt;/p&gt;
&lt;p&gt;After that, I went into college, and in the second semester I managed to get an internship to work on a Delphi application for image processing. After the internship, I joined &lt;a href=&quot;https://www.esss.co/en/&quot;&gt;ESSS&lt;/a&gt;, which is the company I work at to this day.&lt;/p&gt;
&lt;p&gt;My role at ESSS as a technical leader is to manage the technical aspects of the projects I work on, including design and day-to-day code reviews. I’m involved in four projects currently. &lt;/p&gt;
&lt;p&gt;Along with the other technical leaders, I also develop and oversee our high-level efforts, such as migrating all the code from one Python version to the next, solving problems in our CI, implementing development workflows, and many others.&lt;/p&gt;
&lt;p&gt;At ESSS, we develop engineering applications specifically for the oil and gas industry. When I joined, everything was coded in C++, and the team developed everything themselves, including a multiplatform GUI library. A year or so after I was hired, we started looking into Python (version 2.4 at the time) and how we could use it together with PyQt for quickly developing our applications.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/interview-bruno-oliveira/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/interview-bruno-oliveira/ »&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>Identify Invalid Python Syntax</title>
      <id>https://realpython.com/courses/identify-invalid-syntax/</id>
      <link href="https://realpython.com/courses/identify-invalid-syntax/"/>
      <updated>2020-08-11T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll see common examples of invalid syntax in Python and learn how to resolve the issue. If you&#x27;ve ever received a SyntaxError when trying to run your Python code, then this is the guide for you!</summary>
      <content type="html">
        &lt;p&gt;Python is known for its simple syntax. However, when you&amp;rsquo;re learning Python for the first time or when you&amp;rsquo;ve come to Python with a solid background in another programming language, you may run into some things that Python doesn&amp;rsquo;t allow. If you&amp;rsquo;ve ever received a &lt;strong&gt;&lt;code&gt;SyntaxError&lt;/code&gt;&lt;/strong&gt; when trying to run your Python code, then this guide can help you. Throughout this course, you&amp;rsquo;ll see common examples of invalid syntax in Python and learn how to resolve the issue.  &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Identify &lt;strong&gt;invalid syntax&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Make sense of &lt;strong&gt;SyntaxError&lt;/strong&gt; tracebacks&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resolve&lt;/strong&gt; invalid syntax or prevent it altogether&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>Pass by Reference in Python: Background and Best Practices</title>
      <id>https://realpython.com/python-pass-by-reference/</id>
      <link href="https://realpython.com/python-pass-by-reference/"/>
      <updated>2020-08-10T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll explore the concept of passing by reference and learn how it relates to Python&#x27;s own system for handling function arguments. You&#x27;ll look at several use cases for passing by reference and learn some best practices for implementing pass-by-reference constructs in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;After gaining some familiarity with Python, you may notice cases in which your functions don’t modify arguments in place as you might expect, especially if you’re familiar with other programming languages. Some languages handle function arguments as &lt;strong&gt;references&lt;/strong&gt; to existing variables, which is known as &lt;strong&gt;pass by reference&lt;/strong&gt;. Other languages handle them as &lt;strong&gt;independent values&lt;/strong&gt;, an approach known as &lt;strong&gt;pass by value&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you’re an intermediate Python programmer who wishes to understand Python’s peculiar way of handling function arguments, then this tutorial is for you. You’ll implement real use cases of pass-by-reference constructs in Python and learn several best practices to avoid pitfalls with your function arguments.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What it means to &lt;strong&gt;pass by reference&lt;/strong&gt; and why you’d want to do so&lt;/li&gt;
&lt;li&gt;How passing by reference differs from both &lt;strong&gt;passing by value&lt;/strong&gt; and &lt;strong&gt;Python’s unique approach&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;function arguments&lt;/strong&gt; behave in Python&lt;/li&gt;
&lt;li&gt;How you can use certain &lt;strong&gt;mutable types&lt;/strong&gt; to pass by reference in Python&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;best practices&lt;/strong&gt; are for replicating pass by reference in Python&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#x27;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;defining-pass-by-reference&quot;&gt;Defining Pass by Reference&lt;/h2&gt;
&lt;p&gt;Before you dive into the technical details of passing by reference, it’s helpful to take a closer look at the term itself by breaking it down into components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pass&lt;/strong&gt; means to provide an argument to a function.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;By reference&lt;/strong&gt; means that the argument you’re passing to the function is a &lt;strong&gt;reference&lt;/strong&gt; to a variable that already exists in memory rather than an independent copy of that variable.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since you’re giving the function a reference to an existing variable, all operations performed on this reference will directly affect the variable to which it refers. Let’s look at some examples of how this works in practice.&lt;/p&gt;
&lt;p&gt;Below, you’ll see how to pass variables by reference in C#. Note the use of the &lt;a href=&quot;https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ref&quot;&gt;&lt;code&gt;ref&lt;/code&gt; keyword&lt;/a&gt; in the highlighted lines:&lt;/p&gt;
&lt;div class=&quot;highlight csharp&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Source:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/passing-parameters&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Program&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;// Passing by reference.&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// The value of arg in Main is changed.&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;        &lt;span class=&quot;n&quot;&gt;squareRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;ref&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// Output: 16&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;squareRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;ref&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;refParameter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;refParameter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;refParameter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As you can see, the &lt;code&gt;refParameter&lt;/code&gt; of &lt;code&gt;squareRef()&lt;/code&gt; must be declared with the &lt;code&gt;ref&lt;/code&gt; keyword, and you must also use the keyword when calling the function. Then the argument will be passed in by reference and can be modified in place.&lt;/p&gt;
&lt;p&gt;Python has no &lt;code&gt;ref&lt;/code&gt; keyword or anything equivalent to it. If you attempt to replicate the above example as closely as possible in Python, then you’ll see different results:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&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;arg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;square&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arg&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;square&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In this case, the &lt;code&gt;arg&lt;/code&gt; variable is &lt;em&gt;not&lt;/em&gt; altered in place. It seems that Python treats your supplied argument as a standalone value rather than a reference to an existing variable. Does this mean Python passes arguments by value rather than by reference?&lt;/p&gt;
&lt;p&gt;Not quite. Python passes arguments neither by reference nor by value, but &lt;strong&gt;by assignment&lt;/strong&gt;. Below, you’ll quickly explore the details of passing by value and passing by reference before looking more closely at Python’s approach. After that, you’ll walk through some &lt;a href=&quot;#replicating-pass-by-reference-with-python&quot;&gt;best practices&lt;/a&gt; for achieving the equivalent of passing by reference in Python.&lt;/p&gt;
&lt;h2 id=&quot;contrasting-pass-by-reference-and-pass-by-value&quot;&gt;Contrasting Pass by Reference and Pass by Value&lt;/h2&gt;
&lt;p&gt;When you pass function arguments by reference, those arguments are only references to existing values. In contrast, when you pass arguments by value, those arguments become independent copies of the original values.&lt;/p&gt;
&lt;p&gt;Let’s revisit the C# example, this time without using the &lt;code&gt;ref&lt;/code&gt; keyword. This will cause the program to use the default behavior of passing by value:&lt;/p&gt;
&lt;div class=&quot;highlight csharp&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Source:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/passing-parameters&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Program&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;// Passing by value.&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// The value of arg in Main is not changed.&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;        &lt;span class=&quot;n&quot;&gt;squareVal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// Output: 4&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;squareVal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;valParameter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;valParameter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;valParameter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here, you can see that &lt;code&gt;squareVal()&lt;/code&gt; doesn’t modify the original variable. Rather, &lt;code&gt;valParameter&lt;/code&gt; is an independent copy of the original variable &lt;code&gt;arg&lt;/code&gt;. While that matches the behavior you would see in Python, remember that Python doesn’t exactly pass by value. Let’s prove it.&lt;/p&gt;
&lt;p&gt;Python’s built-in &lt;code&gt;id()&lt;/code&gt; returns an integer representing the memory address of the desired object. Using &lt;code&gt;id()&lt;/code&gt;, you can verify the following assertions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Function arguments initially refer to the same address as their original variables.&lt;/li&gt;
&lt;li&gt;Reassigning the argument within the function gives it a new address while the original variable remains unmodified.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the below example, note that the address of &lt;code&gt;x&lt;/code&gt; initially matches that of &lt;code&gt;n&lt;/code&gt; but changes after reassignment, while the address of &lt;code&gt;n&lt;/code&gt; never changes:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&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;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9001&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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Initial address of n: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;increment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;  Final address of n: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;increment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Initial address of x: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;  Final address of x: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&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;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Initial address of n: 140562586057840&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;Initial address of x: 140562586057840&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;  Final address of x: 140562586057968&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;  Final address of n: 140562586057840&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/python-pass-by-reference/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-pass-by-reference/ »&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 #21: Exploring K-means Clustering and Building a Gradebook With Pandas</title>
      <id>https://realpython.com/podcasts/rpp/21/</id>
      <link href="https://realpython.com/podcasts/rpp/21/"/>
      <updated>2020-08-07T12:00:00+00:00</updated>
      <summary>Do you  want to learn the how and when of implementing K-means clustering in Python? Would you like to practice your pandas skills with a real-world project? This week on the show, David Amos is back with another batch of PyCoder’s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Do you  want to learn the how and when of implementing K-means clustering in Python? Would you like to practice your pandas skills with a real-world project? This week on the show, David Amos is back with another batch of PyCoder’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>What Are Python Wheels and Why Should You Care?</title>
      <id>https://realpython.com/python-wheels/</id>
      <link href="https://realpython.com/python-wheels/"/>
      <updated>2020-08-05T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what Python wheels are and why you should care as both a developer and end user of Python packages. You&#x27;ll see how the wheel format has gained momentum over the last decade and how it has made the package installation process faster and more stable.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python &lt;code&gt;.whl&lt;/code&gt; files, or &lt;a href=&quot;https://packaging.python.org/glossary/#term-wheel&quot;&gt;wheels&lt;/a&gt;, are a little-discussed part of Python, but they’ve been a boon to the installation process for Python packages. If you’ve installed a Python package using &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;, then chances are that a wheel has made the installation faster and more efficient.&lt;/p&gt;
&lt;p&gt;Wheels are a component of the Python ecosystem that helps to make package installs &lt;em&gt;just work&lt;/em&gt;. They allow for faster installations and more stability in the package distribution process. In this tutorial, you’ll dive into what wheels are, what good they serve, and how they’ve gained traction and made Python even more of a joy to work with.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What wheels are and how they compare to &lt;strong&gt;source distributions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How you can use wheels to control the &lt;strong&gt;package installation&lt;/strong&gt; process&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;create and distribute&lt;/strong&gt; wheels for your own Python packages&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll see examples using popular open source Python packages from both the user’s and the developer’s perspective.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-shortened&quot; data-focus=&quot;false&quot;&gt;Click here to get a Python Cheat Sheet&lt;/a&gt; and learn the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;setup&quot;&gt;Setup&lt;/h2&gt;
&lt;p&gt;To follow along, activate a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; and make sure you have the latest versions of &lt;code&gt;pip&lt;/code&gt;, &lt;code&gt;wheel&lt;/code&gt;, and &lt;code&gt;setuptools&lt;/code&gt; installed:&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 venv env &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; ./env/bin/activate
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python -m pip install -U pip wheel setuptools
&lt;span class=&quot;go&quot;&gt;Successfully installed pip 20.1 setuptools-46.1.3 wheel-0.34.2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That’s all you need to experiment with installing and building wheels!&lt;/p&gt;
&lt;h2 id=&quot;python-packaging-made-better-an-intro-to-python-wheels&quot;&gt;Python Packaging Made Better: An Intro to Python Wheels&lt;/h2&gt;
&lt;p&gt;Before you learn how to package a project into a wheel, it helps to know what using one looks like from the user’s side. It may sound backward, but a good way to learn how wheels work is to start by installing something that &lt;em&gt;isn’t&lt;/em&gt; a wheel.&lt;/p&gt;
&lt;p&gt;You can start this experiment by installing a Python package into your environment just as you might normally do. In this case, install &lt;a href=&quot;https://github.com/unbit/uwsgi&quot;&gt;uWSGI&lt;/a&gt; version 2.0.x:&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;lineno&quot;&gt; 1 &lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python -m pip install &lt;span class=&quot;s1&quot;&gt;&#x27;uwsgi==2.0.*&#x27;&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 2 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Collecting uwsgi==2.0.*&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 3 &lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;  Downloading uwsgi-2.0.18.tar.gz (801 kB)&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;lineno&quot;&gt; 4 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;     |████████████████████████████████| 801 kB 1.1 MB/s&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 5 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Building wheels for collected packages: uwsgi&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 6 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;  Building wheel for uwsgi (setup.py) ... done&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 7 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;  Created wheel for uwsgi ... uWSGI-2.0.18-cp38-cp38-macosx_10_15_x86_64.whl&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 8 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;  Stored in directory: /private/var/folders/jc/8_hqsz0x1tdbp05 ...&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 9 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Successfully built uwsgi&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;10 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Installing collected packages: uwsgi&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;11 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Successfully installed uwsgi-2.0.18&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;To fully install uWSGI, &lt;code&gt;pip&lt;/code&gt; progresses through several distinct steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On &lt;strong&gt;line 3&lt;/strong&gt;, it downloads a TAR file (tarball) named &lt;code&gt;uwsgi-2.0.18.tar.gz&lt;/code&gt; that’s been compressed with &lt;a href=&quot;https://www.gnu.org/software/gzip/manual/gzip.html&quot;&gt;gzip&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;line 6&lt;/strong&gt;, it takes the tarball and builds a &lt;code&gt;.whl&lt;/code&gt; file through a call to &lt;code&gt;setup.py&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;line 7&lt;/strong&gt;, it labels the wheel &lt;code&gt;uWSGI-2.0.18-cp38-cp38-macosx_10_15_x86_64.whl&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;line 10&lt;/strong&gt;, it installs the actual package after having built the wheel.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;code&gt;tar.gz&lt;/code&gt; tarball that &lt;code&gt;pip&lt;/code&gt; retrieves is a &lt;strong&gt;source distribution&lt;/strong&gt;, or &lt;code&gt;sdist&lt;/code&gt;, rather than a wheel. In some ways, a &lt;code&gt;sdist&lt;/code&gt; is the opposite of a wheel.&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 see an error with the uWSGI installation, you may need to &lt;a href=&quot;https://uwsgi-docs.readthedocs.io/en/latest/Install.html#installing-from-source&quot;&gt;install the Python development headers&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;A &lt;a href=&quot;https://packaging.python.org/glossary/#term-source-distribution-or-sdist&quot;&gt;source distribution&lt;/a&gt; contains source code. That includes not only Python code but also the source code of any extension modules (usually in C or &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt;) bundled with the package. With source distributions, extension modules are compiled on the user’s side rather than the developer’s.&lt;/p&gt;
&lt;p&gt;Source distributions also contain a bundle of metadata sitting in a directory called &lt;a href=&quot;https://setuptools.readthedocs.io/en/latest/formats.html&quot;&gt;&lt;code&gt;&amp;lt;package-name&amp;gt;.egg-info&lt;/code&gt;&lt;/a&gt;. This metadata helps with building and installing the package, but user’s don’t really need to do anything with it.&lt;/p&gt;
&lt;p&gt;From the developer’s perspective, a source distribution is what gets created when you 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; python setup.py sdist
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now try installing a different package, &lt;a href=&quot;https://github.com/chardet/chardet/blob/master/docs/index.rst&quot;&gt;chardet&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;lineno&quot;&gt; 1 &lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python -m pip install &lt;span class=&quot;s1&quot;&gt;&#x27;chardet==3.*&#x27;&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 2 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Collecting chardet&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 3 &lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;lineno&quot;&gt; 4 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;     |████████████████████████████████| 133 kB 1.5 MB/s&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 5 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Installing collected packages: chardet&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 6 &lt;/span&gt;&lt;span class=&quot;go&quot;&gt;Successfully installed chardet-3.0.4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can see a noticeably different output than the uWSGI install.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-wheels/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-wheels/ »&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>Practical Recipes for Working With Files in Python</title>
      <id>https://realpython.com/courses/practical-recipes-files/</id>
      <link href="https://realpython.com/courses/practical-recipes-files/"/>
      <updated>2020-08-04T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how you can work with files in Python by using built-in modules to perform practical tasks that involve groups of files, like renaming them, moving them around, archiving them, and getting their metadata.</summary>
      <content type="html">
        &lt;p&gt;Python has several built-in modules and functions for &lt;strong&gt;handling files&lt;/strong&gt;. These functions are spread out over several modules such as &lt;code&gt;os&lt;/code&gt;, &lt;code&gt;os.path&lt;/code&gt;, &lt;code&gt;shutil&lt;/code&gt;, and &lt;code&gt;pathlib&lt;/code&gt;, to name a few. This course gathers in one place many of the functions you need to know in order to perform the most common operations on files in Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Retrieve file &lt;strong&gt;properties&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;directories&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Match patterns in &lt;strong&gt;filenames&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Traverse &lt;strong&gt;directory trees&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Make &lt;strong&gt;temporary files&lt;/strong&gt; and directories&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Delete&lt;/strong&gt; files and directories&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Copy&lt;/strong&gt;, &lt;strong&gt;move&lt;/strong&gt;, or &lt;strong&gt;rename&lt;/strong&gt; files and directories&lt;/li&gt;
&lt;li&gt;Create and extract &lt;strong&gt;ZIP&lt;/strong&gt; archives&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>Customize the Django Admin With Python</title>
      <id>https://realpython.com/customize-django-admin-python/</id>
      <link href="https://realpython.com/customize-django-admin-python/"/>
      <updated>2020-08-03T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to customize Django&#x27;s admin with Python. You&#x27;ll use AdminModel objects to add display columns, calculate values, link to referring objects, and search and filter results. You&#x27;ll also use template overriding to gain full control over the admin&#x27;s HTML.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;&lt;strong&gt;Django&lt;/strong&gt;&lt;/a&gt; framework comes with a powerful &lt;a href=&quot;https://docs.djangoproject.com/en/3.0/ref/contrib/admin/&quot;&gt;administrative tool&lt;/a&gt; called &lt;strong&gt;admin&lt;/strong&gt;. You can use it out of the box to quickly add, delete, or edit any database model from a web interface. But with a little extra code, you can customize the Django admin to take your admin capabilities to the next level.&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;Add &lt;strong&gt;attribute columns&lt;/strong&gt; in the model object list &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link&lt;/strong&gt; between model objects&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;filters&lt;/strong&gt; to the model object list&lt;/li&gt;
&lt;li&gt;Make model object lists &lt;strong&gt;searchable&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Modify the object &lt;strong&gt;edit forms&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Override Django &lt;strong&gt;admin templates&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;#&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-django-resources-learing-guide&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a free Django Learning Resources Guide (PDF)&lt;/a&gt; that shows you tips and tricks as well as common pitfalls to avoid when building Python + Django web applications.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;To get the most out of this tutorial, you’ll need some familiarity with Django, particularly model objects. As Django isn’t part of the standard Python library, it’s best if you also have some knowledge of &lt;code&gt;pip&lt;/code&gt; and &lt;code&gt;pyenv&lt;/code&gt; (or an equivalent &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; tool). To learn more about these topics, check out the following resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/get-started-with-django-1/&quot;&gt;Get Started With Django Part 1: Build a Portfolio App&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;What is Pip? A Guide for New Pythonistas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/intro-to-pyenv/&quot;&gt;Managing Multiple Python Versions With pyenv&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/lessons/what-virtual-environments-are-good-for/&quot;&gt;What Virtual Environments Are Good For&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You may also be interested in one of the many available &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django tutorials&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The code snippets in this tutorial were tested against Django 3.0.7. All the concepts predate Django 2.0, so they should work in whatever version you’re using, but minor differences may exist.&lt;/p&gt;
&lt;h2 id=&quot;setting-up-the-django-admin&quot;&gt;Setting Up the Django Admin&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Django admin&lt;/strong&gt; provides a web-based interface for creating and managing database model objects. To see it in action, you’ll first need a Django project and some object models. Install Django inside a clean virtual environment:&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 django
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; django-admin startproject School
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; School
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; ./manage.py startapp core
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; ./manage.py migrate
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; ./manage.py createsuperuser
&lt;span class=&quot;go&quot;&gt;Username: admin&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Email address: admin@example.com&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Password:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Password (again):&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You first create a new Django project named &lt;code&gt;School&lt;/code&gt; with an app called &lt;code&gt;core&lt;/code&gt;. Then you migrate the authentication tables and create an administrator. Access to the Django admin screens is restricted to users with &lt;code&gt;staff&lt;/code&gt; or &lt;code&gt;superuser&lt;/code&gt; flags, so you use the &lt;code&gt;createsuperuser&lt;/code&gt; management command to create a &lt;code&gt;superuser&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You also need to modify &lt;code&gt;School/settings.py&lt;/code&gt; to include the new app named &lt;code&gt;core&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# School/settings.py&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;INSTALLED_APPS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.admin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.auth&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.contenttypes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.sessions&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.messages&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.staticfiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;core&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# Add this line&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;core&lt;/code&gt; app directory will start with the following files inside:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;core/
│
├── migrations/
│   └── __init__.py
│
├── __init__.py
├── admin.py
├── apps.py
├── models.py
├── tests.py
└── views.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You’re interested in two of these files: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;models.py&lt;/code&gt;&lt;/strong&gt; defines your database models.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;admin.py&lt;/code&gt;&lt;/strong&gt; registers your models with the Django admin.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To demonstrate the outcome when you customize the Django admin, you’ll need some models. Edit &lt;code&gt;core/models.py&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;django.core.validators&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MinValueValidator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MaxValueValidator&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;django.db&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;last_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TextField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;first_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TextField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;courses&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ManyToManyField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Course&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;blank&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Meta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;verbose_name_plural&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;People&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Course&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TextField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;year&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IntegerField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Meta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;unique_together&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;year&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Grade&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ForeignKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on_delete&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CASCADE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;grade&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PositiveSmallIntegerField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;validators&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;n&quot;&gt;MinValueValidator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MaxValueValidator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)])&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;course&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ForeignKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Course&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on_delete&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CASCADE&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;These models represent students taking courses at a school. A &lt;code&gt;Course&lt;/code&gt; has a &lt;code&gt;name&lt;/code&gt; and a &lt;code&gt;year&lt;/code&gt; in which it was offered. A &lt;code&gt;Person&lt;/code&gt; has a first and last name and can take zero or more &lt;code&gt;courses&lt;/code&gt;. A &lt;code&gt;Grade&lt;/code&gt; contains a percentage score that a &lt;code&gt;Person&lt;/code&gt; received on a &lt;code&gt;Course&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Here’s a model diagram showing the relationships between the objects:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://files.realpython.com/media/customize-django-admin-db.ba7ba1f27a98.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/customize-django-admin-db.ba7ba1f27a98.png&quot; width=&quot;1024&quot; height=&quot;495&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/customize-django-admin-db.ba7ba1f27a98.png&amp;amp;w=256&amp;amp;sig=9eee386d616289854cc566e442e0641f3ced868c 256w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/customize-django-admin-db.ba7ba1f27a98.png&amp;amp;w=512&amp;amp;sig=69e9df1dd3dc6ab6a1376542496726a2a77b13f4 512w, https://files.realpython.com/media/customize-django-admin-db.ba7ba1f27a98.png 1024w&quot; sizes=&quot;75vw&quot; alt=&quot;Sample Object Model Relationships&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The underlying table names in the database are slightly different from this, but they’re related to the models shown above.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/customize-django-admin-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/customize-django-admin-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #20: Building PDFs in Python with ReportLab</title>
      <id>https://realpython.com/podcasts/rpp/20/</id>
      <link href="https://realpython.com/podcasts/rpp/20/"/>
      <updated>2020-07-31T12:00:00+00:00</updated>
      <summary>Have you wanted to generate advanced reports as PDFs using Python? Maybe you want to build documents with tables, images, or fillable forms. This week on the show we have Mike Driscoll to talk about his book &quot;ReportLab - PDF Processing with Python.&quot;</summary>
      <content type="html">
        &lt;p&gt;Have you wanted to generate advanced reports as PDFs using Python? Maybe you want to build documents with tables, images, or fillable forms. This week on the show we have Mike Driscoll to talk about his book &quot;ReportLab - PDF Processing with Python.&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Namespaces and Scope in Python</title>
      <id>https://realpython.com/python-namespaces-scope/</id>
      <link href="https://realpython.com/python-namespaces-scope/"/>
      <updated>2020-07-29T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about Python namespaces, the structures used to store and organize the symbolic names created during execution of a Python program. You&#x27;ll learn when namespaces are created, how they are implemented, and how they define variable scope.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;This tutorial covers Python &lt;strong&gt;namespaces&lt;/strong&gt;, the structures used to organize the symbolic names assigned to objects in a Python program.&lt;/p&gt;
&lt;p&gt;The previous tutorials in this series have emphasized the importance of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming&quot;&gt;&lt;strong&gt;objects&lt;/strong&gt;&lt;/a&gt; in Python. Objects are everywhere! Virtually everything that your Python program creates or acts on is an object.&lt;/p&gt;
&lt;p&gt;An &lt;strong&gt;assignment statement&lt;/strong&gt; creates a &lt;strong&gt;symbolic name&lt;/strong&gt; that you can use to reference an object. The statement &lt;code&gt;x = &#x27;foo&#x27;&lt;/code&gt; creates a symbolic name &lt;code&gt;x&lt;/code&gt; that refers to the string object &lt;code&gt;&#x27;foo&#x27;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In a program of any complexity, you’ll create hundreds or thousands of such names, each pointing to a specific object. How does Python keep track of all these names so that they don’t interfere with one another?&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 Python organizes symbolic names and objects in &lt;strong&gt;namespaces&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;When Python creates a new namespace&lt;/li&gt;
&lt;li&gt;How namespaces are implemented&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;variable scope&lt;/strong&gt; determines symbolic name visibility&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#x27;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;namespaces-in-python&quot;&gt;Namespaces in Python&lt;/h2&gt;
&lt;p&gt;A namespace is a collection of currently defined symbolic names along with information about the object that each name references. You can think of a namespace as a &lt;a href=&quot;https://realpython.com/python-dicts&quot;&gt;dictionary&lt;/a&gt; in which the keys are the object names and the values are the objects themselves. Each key-value pair maps a name to its corresponding object.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Namespaces are one honking great idea—let’s do more of those!&lt;/p&gt;
&lt;p&gt;— &lt;em&gt;&lt;a href=&quot;https://www.python.org/dev/peps/pep-0020&quot;&gt;The Zen of Python&lt;/a&gt;, by Tim Peters&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As Tim Peters suggests, namespaces aren’t just great. They’re &lt;em&gt;honking&lt;/em&gt; great, and Python uses them extensively. In a Python program, there are four types of namespaces:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Built-In&lt;/li&gt;
&lt;li&gt;Global&lt;/li&gt;
&lt;li&gt;Enclosing&lt;/li&gt;
&lt;li&gt;Local&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;These have differing lifetimes. As Python executes a program, it creates namespaces as necessary and deletes them when they’re no longer needed. Typically, many namespaces will exist at any given time.&lt;/p&gt;
&lt;h3 id=&quot;the-built-in-namespace&quot;&gt;The Built-In Namespace&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;built-in namespace&lt;/strong&gt; contains the names of all of Python’s built-in objects. These are available at all times when Python is running. You can list the objects in the built-in namespace with the following command:&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;n&quot;&gt;__builtins__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[&#x27;ArithmeticError&#x27;, &#x27;AssertionError&#x27;, &#x27;AttributeError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;BaseException&#x27;,&#x27;BlockingIOError&#x27;, &#x27;BrokenPipeError&#x27;, &#x27;BufferError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;BytesWarning&#x27;, &#x27;ChildProcessError&#x27;, &#x27;ConnectionAbortedError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;ConnectionError&#x27;, &#x27;ConnectionRefusedError&#x27;, &#x27;ConnectionResetError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;DeprecationWarning&#x27;, &#x27;EOFError&#x27;, &#x27;Ellipsis&#x27;, &#x27;EnvironmentError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;Exception&#x27;, &#x27;False&#x27;, &#x27;FileExistsError&#x27;, &#x27;FileNotFoundError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;FloatingPointError&#x27;, &#x27;FutureWarning&#x27;, &#x27;GeneratorExit&#x27;, &#x27;IOError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;ImportError&#x27;, &#x27;ImportWarning&#x27;, &#x27;IndentationError&#x27;, &#x27;IndexError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;InterruptedError&#x27;, &#x27;IsADirectoryError&#x27;, &#x27;KeyError&#x27;, &#x27;KeyboardInterrupt&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;LookupError&#x27;, &#x27;MemoryError&#x27;, &#x27;ModuleNotFoundError&#x27;, &#x27;NameError&#x27;, &#x27;None&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;NotADirectoryError&#x27;, &#x27;NotImplemented&#x27;, &#x27;NotImplementedError&#x27;, &#x27;OSError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;OverflowError&#x27;, &#x27;PendingDeprecationWarning&#x27;, &#x27;PermissionError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;ProcessLookupError&#x27;, &#x27;RecursionError&#x27;, &#x27;ReferenceError&#x27;, &#x27;ResourceWarning&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;RuntimeError&#x27;, &#x27;RuntimeWarning&#x27;, &#x27;StopAsyncIteration&#x27;, &#x27;StopIteration&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;SyntaxError&#x27;, &#x27;SyntaxWarning&#x27;, &#x27;SystemError&#x27;, &#x27;SystemExit&#x27;, &#x27;TabError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;TimeoutError&#x27;, &#x27;True&#x27;, &#x27;TypeError&#x27;, &#x27;UnboundLocalError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;UnicodeDecodeError&#x27;, &#x27;UnicodeEncodeError&#x27;, &#x27;UnicodeError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;UnicodeTranslateError&#x27;, &#x27;UnicodeWarning&#x27;, &#x27;UserWarning&#x27;, &#x27;ValueError&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;Warning&#x27;, &#x27;ZeroDivisionError&#x27;, &#x27;_&#x27;, &#x27;__build_class__&#x27;, &#x27;__debug__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;__doc__&#x27;, &#x27;__import__&#x27;, &#x27;__loader__&#x27;, &#x27;__name__&#x27;, &#x27;__package__&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;__spec__&#x27;, &#x27;abs&#x27;, &#x27;all&#x27;, &#x27;any&#x27;, &#x27;ascii&#x27;, &#x27;bin&#x27;, &#x27;bool&#x27;, &#x27;bytearray&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;bytes&#x27;, &#x27;callable&#x27;, &#x27;chr&#x27;, &#x27;classmethod&#x27;, &#x27;compile&#x27;, &#x27;complex&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;copyright&#x27;, &#x27;credits&#x27;, &#x27;delattr&#x27;, &#x27;dict&#x27;, &#x27;dir&#x27;, &#x27;divmod&#x27;, &#x27;enumerate&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;eval&#x27;, &#x27;exec&#x27;, &#x27;exit&#x27;, &#x27;filter&#x27;, &#x27;float&#x27;, &#x27;format&#x27;, &#x27;frozenset&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;getattr&#x27;, &#x27;globals&#x27;, &#x27;hasattr&#x27;, &#x27;hash&#x27;, &#x27;help&#x27;, &#x27;hex&#x27;, &#x27;id&#x27;, &#x27;input&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;int&#x27;, &#x27;isinstance&#x27;, &#x27;issubclass&#x27;, &#x27;iter&#x27;, &#x27;len&#x27;, &#x27;license&#x27;, &#x27;list&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;locals&#x27;, &#x27;map&#x27;, &#x27;max&#x27;, &#x27;memoryview&#x27;, &#x27;min&#x27;, &#x27;next&#x27;, &#x27;object&#x27;, &#x27;oct&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;open&#x27;, &#x27;ord&#x27;, &#x27;pow&#x27;, &#x27;print&#x27;, &#x27;property&#x27;, &#x27;quit&#x27;, &#x27;range&#x27;, &#x27;repr&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;reversed&#x27;, &#x27;round&#x27;, &#x27;set&#x27;, &#x27;setattr&#x27;, &#x27;slice&#x27;, &#x27;sorted&#x27;, &#x27;staticmethod&#x27;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; &#x27;str&#x27;, &#x27;sum&#x27;, &#x27;super&#x27;, &#x27;tuple&#x27;, &#x27;type&#x27;, &#x27;vars&#x27;, &#x27;zip&#x27;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You’ll see some objects here that you may recognize from previous tutorials—for example, the &lt;a href=&quot;https://realpython.com/python-for-loop/#the-guts-of-the-python-for-loop&quot;&gt;&lt;code&gt;StopIteration&lt;/code&gt;&lt;/a&gt; exception, &lt;a href=&quot;https://realpython.com/python-data-types/#built-in-functions&quot;&gt;built-in functions&lt;/a&gt; like &lt;code&gt;max()&lt;/code&gt; and &lt;code&gt;len()&lt;/code&gt;, and object types like &lt;code&gt;int&lt;/code&gt; and &lt;code&gt;str&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The Python interpreter creates the built-in namespace when it starts up. This namespace remains in existence until the interpreter terminates.&lt;/p&gt;
&lt;h3 id=&quot;the-global-namespace&quot;&gt;The Global Namespace&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;global namespace&lt;/strong&gt; contains any names defined at the level of the main program. Python creates the global namespace when the main program body starts, and it remains in existence until the interpreter terminates.&lt;/p&gt;
&lt;p&gt;Strictly speaking, this may not be the only global namespace that exists. The interpreter also creates a global namespace for any &lt;strong&gt;module&lt;/strong&gt; that your program loads with the &lt;a href=&quot;https://realpython.com/absolute-vs-relative-python-imports/&quot;&gt;&lt;code&gt;import&lt;/code&gt;&lt;/a&gt; statement. For further reading on main functions and modules in Python, see these resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-main-function&quot;&gt;Defining Main Functions in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-modules-packages&quot;&gt;Python Modules and Packages—An Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/python-modules-packages&quot;&gt;Course: Python Modules and Packages&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll explore modules in more detail in a future tutorial in this series. For the moment, when you see the term &lt;em&gt;global namespace&lt;/em&gt;, think of the one belonging to the main program.&lt;/p&gt;
&lt;h3 id=&quot;the-local-and-enclosing-namespaces&quot;&gt;The Local and Enclosing Namespaces&lt;/h3&gt;
&lt;p&gt;As you learned in the previous tutorial on &lt;a href=&quot;https://realpython.com/defining-your-own-python-function&quot;&gt;functions&lt;/a&gt;, the interpreter creates a new namespace whenever a function executes. That namespace is local to the function and remains in existence until the function terminates.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-namespaces-scope/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-namespaces-scope/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s None: Null in Python</title>
      <id>https://realpython.com/courses/python-none/</id>
      <link href="https://realpython.com/courses/python-none/"/>
      <updated>2020-07-28T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn about the NoneType object None, which acts as the null in Python. This object represents emptiness, and you can use it to mark default parameters and even show when you have no result. None is a tool for doing everything with nothing!</summary>
      <content type="html">
        &lt;p&gt;If you have experience with other programming languages, like &lt;a href=&quot;https://realpython.com/build-python-c-extension-module/&quot;&gt;C&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/oop-in-python-vs-java/&quot;&gt;Java&lt;/a&gt;, then you&amp;rsquo;ve probably heard of the concept of &lt;strong&gt;&lt;code&gt;null&lt;/code&gt;&lt;/strong&gt;. Many languages use this to represent a &lt;a href=&quot;https://realpython.com/pointers-in-python/&quot;&gt;pointer&lt;/a&gt; that doesn&amp;rsquo;t point to anything, to denote when a variable is empty, or to mark default parameters that you haven&amp;rsquo;t yet supplied. &lt;code&gt;null&lt;/code&gt; is often defined to be &lt;code&gt;0&lt;/code&gt; in those languages, but &lt;code&gt;null&lt;/code&gt; in Python is different.&lt;/p&gt;
&lt;p&gt;Python uses the &lt;a href=&quot;https://realpython.com/python-keywords/&quot;&gt;keyword&lt;/a&gt; &lt;code&gt;None&lt;/code&gt; to define &lt;code&gt;null&lt;/code&gt; objects and variables. While &lt;code&gt;None&lt;/code&gt; does serve some of the same purposes as &lt;code&gt;null&lt;/code&gt; in other languages, it&amp;rsquo;s another beast entirely. As the &lt;code&gt;null&lt;/code&gt; in Python, &lt;code&gt;None&lt;/code&gt; is not defined to be &lt;code&gt;0&lt;/code&gt; or any other value. In Python, &lt;code&gt;None&lt;/code&gt; is an object and a first-class citizen!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;&lt;code&gt;None&lt;/code&gt;&lt;/strong&gt; is and how to test for it&lt;/li&gt;
&lt;li&gt;When and why to use &lt;code&gt;None&lt;/code&gt; as a &lt;strong&gt;default parameter&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What &lt;code&gt;None&lt;/code&gt; and &lt;code&gt;NoneType&lt;/code&gt; mean in your &lt;strong&gt;traceback&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to use &lt;code&gt;None&lt;/code&gt; in &lt;strong&gt;type checking&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;&lt;code&gt;null&lt;/code&gt; in Python&lt;/strong&gt; works under the hood&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>Generative Adversarial Networks: Build Your First Models</title>
      <id>https://realpython.com/generative-adversarial-networks/</id>
      <link href="https://realpython.com/generative-adversarial-networks/"/>
      <updated>2020-07-27T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn all about one of the most exciting areas of research in the field of machine learning: generative adversarial networks. You&#x27;ll learn the basics of how GANs are structured and trained before implementing your own generative model using PyTorch.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Generative adversarial networks&lt;/strong&gt; (GANs) are &lt;a href=&quot;https://en.wikipedia.org/wiki/Artificial_neural_network&quot;&gt;neural networks&lt;/a&gt; that generate material, such as images, music, speech, or text, that is similar to what humans produce.&lt;/p&gt;
&lt;p&gt;GANs have been an active topic of research in recent years. Facebook’s AI research director Yann LeCun called adversarial training &lt;a href=&quot;https://www.quora.com/What-are-some-recent-and-potentially-upcoming-breakthroughs-in-deep-learning&quot;&gt;“the most interesting idea in the last 10 years”&lt;/a&gt; in the field of machine learning. Below, you’ll learn how GANs work before implementing two generative models of your own.  &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What a &lt;strong&gt;generative model&lt;/strong&gt; is and how it differs from a &lt;strong&gt;discriminative model&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How GANs are &lt;strong&gt;structured&lt;/strong&gt; and &lt;strong&gt;trained&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;build your own GAN&lt;/strong&gt; using &lt;a href=&quot;https://pytorch.org/&quot;&gt;PyTorch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;train your GAN&lt;/strong&gt; for practical applications using a GPU and PyTorch&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let’s get started!&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#x27;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;what-are-generative-adversarial-networks&quot;&gt;What Are Generative Adversarial Networks?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Generative adversarial networks&lt;/strong&gt; are machine learning systems that can learn to mimic a given distribution of data. They were first proposed in a 2014 &lt;a href=&quot;https://papers.nips.cc/paper/5423-generative-adversarial-nets.pdf&quot;&gt;NeurIPS paper&lt;/a&gt; by deep learning expert Ian Goodfellow and his colleagues.&lt;/p&gt;
&lt;p&gt;GANs consist of two neural networks, one trained to generate data and the other trained to distinguish fake data from real data (hence the “adversarial” nature of the model). Although the idea of a structure to generate data isn’t new, when it comes to image and video generation, GANs have provided impressive results such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Style transfer using &lt;a href=&quot;https://github.com/junyanz/CycleGAN/&quot;&gt;CycleGAN&lt;/a&gt;, which can perform a number of convincing style transformations on images&lt;/li&gt;
&lt;li&gt;Generation of human faces with &lt;a href=&quot;https://en.wikipedia.org/wiki/StyleGAN&quot;&gt;StyleGAN&lt;/a&gt;, as demonstrated on the website &lt;a href=&quot;https://www.thispersondoesnotexist.com/&quot;&gt;This Person Does Not Exist&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Structures that generate data, including GANs, are considered &lt;strong&gt;generative models&lt;/strong&gt; in contrast to the more widely studied &lt;strong&gt;discriminative models&lt;/strong&gt;. Before diving into GANs, you’ll look at the differences between these two kinds of models.&lt;/p&gt;
&lt;h2 id=&quot;discriminative-vs-generative-models&quot;&gt;Discriminative vs Generative Models&lt;/h2&gt;
&lt;p&gt;If you’ve studied neural networks, then most of the applications you’ve come across were likely implemented using &lt;a href=&quot;https://en.wikipedia.org/wiki/Discriminative_model&quot;&gt;discriminative models&lt;/a&gt;. Generative adversarial networks, on the other hand, are part of a different class of models known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Generative_model&quot;&gt;generative models&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Discriminative models are those used for most &lt;a href=&quot;https://en.wikipedia.org/wiki/Supervised_learning&quot;&gt;supervised&lt;/a&gt; &lt;strong&gt;classification&lt;/strong&gt; or &lt;strong&gt;regression&lt;/strong&gt; problems. As an example of a classification problem, suppose you’d like to train a model to classify images of handwritten digits from 0 to 9. For that, you could use a labeled dataset containing images of handwritten digits and their associated labels indicating which digit each image represents.&lt;/p&gt;
&lt;p&gt;During the training process, you’d use an algorithm to adjust the model’s parameters. The goal would be to minimize a &lt;a href=&quot;https://en.wikipedia.org/wiki/Loss_function&quot;&gt;loss function&lt;/a&gt; so that the model learns the &lt;strong&gt;probability distribution&lt;/strong&gt; of the output given the input. After the training phase, you could use the model to classify a new handwritten digit image by estimating the most probable digit the input corresponds to, as illustrated in the figure below:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://files.realpython.com/media/fig_discriminative.9c22a1cd877d.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-100&quot; src=&quot;https://files.realpython.com/media/fig_discriminative.9c22a1cd877d.png&quot; width=&quot;1140&quot; height=&quot;388&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/fig_discriminative.9c22a1cd877d.png&amp;amp;w=285&amp;amp;sig=e71ca3d5e41a29f8c9d2d86188c09275f60ce3e7 285w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/fig_discriminative.9c22a1cd877d.png&amp;amp;w=570&amp;amp;sig=4c5ec0f7b27a5ba6daeb059f0ad1e4a1182983b2 570w, https://files.realpython.com/media/fig_discriminative.9c22a1cd877d.png 1140w&quot; sizes=&quot;75vw&quot; alt=&quot;Discriminative Model&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can picture discriminative models for classification problems as blocks that use the training data to learn the boundaries between classes. They then use these boundaries to discriminate an input and predict its class. In mathematical terms, discriminative models learn the conditional probability &lt;em&gt;P&lt;/em&gt;(&lt;em&gt;y&lt;/em&gt;|&lt;em&gt;x&lt;/em&gt;) of the output &lt;em&gt;y&lt;/em&gt; given the input &lt;em&gt;x&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Besides neural networks, other structures can be used as discriminative models such as &lt;a href=&quot;https://realpython.com/logistic-regression-python/&quot;&gt;logistic regression&lt;/a&gt; models and &lt;a href=&quot;https://en.wikipedia.org/wiki/Support_vector_machine&quot;&gt;support vector machines&lt;/a&gt; (SVMs).&lt;/p&gt;
&lt;p&gt;Generative models like GANs, however, are trained to describe how a dataset is generated in terms of a &lt;strong&gt;probabilistic&lt;/strong&gt; model. By sampling from a generative model, you’re able to generate new data. While discriminative models are used for supervised learning, generative models are often used with unlabeled datasets and can be seen as a form of &lt;a href=&quot;https://en.wikipedia.org/wiki/Unsupervised_learning&quot;&gt;unsupervised learning&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Using the dataset of handwritten digits, you could train a generative model to generate new digits. During the training phase, you’d use some algorithm to adjust the model’s parameters to minimize a loss function and learn the probability distribution of the training set. Then, with the model trained, you could generate new samples, as illustrated in the following figure:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://files.realpython.com/media/fig_generative.5f01c08f5208.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-100&quot; src=&quot;https://files.realpython.com/media/fig_generative.5f01c08f5208.png&quot; width=&quot;1140&quot; height=&quot;388&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/fig_generative.5f01c08f5208.png&amp;amp;w=285&amp;amp;sig=340b3269cb555820bd74796f85b001a529a11d21 285w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/fig_generative.5f01c08f5208.png&amp;amp;w=570&amp;amp;sig=9764df11284a1e07ff5433fcde4c953cc59081fd 570w, https://files.realpython.com/media/fig_generative.5f01c08f5208.png 1140w&quot; sizes=&quot;75vw&quot; alt=&quot;Generative Model&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To output new samples, generative models usually consider a &lt;strong&gt;stochastic&lt;/strong&gt;, or random, element that influences the samples generated by the model. The random samples used to drive the generator are obtained from a &lt;strong&gt;latent space&lt;/strong&gt; in which the vectors represent a kind of compressed form of the generated samples.&lt;/p&gt;
&lt;p&gt;Unlike discriminative models, generative models learn the probability &lt;em&gt;P&lt;/em&gt;(&lt;em&gt;x&lt;/em&gt;) of the input data &lt;em&gt;x&lt;/em&gt;, and by having the distribution of the input data, they’re able to generate new data instances.&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; Generative models can also be used with labeled datasets. When they are, they’re trained to learn the probability &lt;em&gt;P&lt;/em&gt;(&lt;em&gt;x&lt;/em&gt;|&lt;em&gt;y&lt;/em&gt;) of the input &lt;em&gt;x&lt;/em&gt; given the output &lt;em&gt;y&lt;/em&gt;. They can also be used for classification tasks, but in general, discriminative models perform better when it comes to classification.&lt;/p&gt;
&lt;p&gt;You can find more information on the relative strengths and weaknesses of discriminative and generative classifiers in the article &lt;a href=&quot;https://papers.nips.cc/paper/2020-on-discriminative-vs-generative-classifiers-a-comparison-of-logistic-regression-and-naive-bayes&quot;&gt;On Discriminative vs. Generative Classifiers: A comparison of logistic regression and naive Bayes&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Although GANs have received a lot of attention in recent years, they’re not the only architecture that can be used as a generative model. Besides GANs, there are various other generative model architectures such as:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/generative-adversarial-networks/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/generative-adversarial-networks/ »&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 #19: Advanced Python Import Techniques and Managing Users in Django</title>
      <id>https://realpython.com/podcasts/rpp/19/</id>
      <link href="https://realpython.com/podcasts/rpp/19/"/>
      <updated>2020-07-24T12:00:00+00:00</updated>
      <summary>Would you like to clearly understand what&#x27;s happening when you use the Python import keyword? Do you want to use modules more effectively to structure your code? Or maybe you&#x27;re ready to move to the next level with your Django project by adding user management. This week on the show, David Amos is back with another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Would you like to clearly understand what&#x27;s happening when you use the Python import keyword? Do you want to use modules more effectively to structure your code? Or maybe you&#x27;re ready to move to the next level with your Django project by adding user management. This week on the show, David Amos is back with 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>Mastering Python&#x27;s Built-in time Module</title>
      <id>https://realpython.com/courses/mastering-time-module/</id>
      <link href="https://realpython.com/courses/mastering-time-module/"/>
      <updated>2020-07-21T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to use the Python time module to represent dates and times in your application, manage code execution, and measure performance.</summary>
      <content type="html">
        &lt;p&gt;The Python &lt;code&gt;time&lt;/code&gt; module provides many ways of &lt;strong&gt;representing time&lt;/strong&gt; in code, such as objects, numbers, and strings. It also provides functionality other than representing time, like waiting during code execution and measuring the efficiency of your code.&lt;/p&gt;
&lt;p&gt;This course will walk you through the most commonly used functions and objects in &lt;code&gt;time&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Understand&lt;/strong&gt; core concepts at the heart of working with dates and times, such as epochs, time zones, and daylight savings time&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Represent&lt;/strong&gt; time in code using floats, tuples, and &lt;code&gt;struct_time&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Convert&lt;/strong&gt; between different time representations&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Suspend&lt;/strong&gt; thread execution&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Measure&lt;/strong&gt; code performance using &lt;code&gt;perf_counter()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #18: Ten Years of Flask: Conversation With Creator Armin Ronacher</title>
      <id>https://realpython.com/podcasts/rpp/18/</id>
      <link href="https://realpython.com/podcasts/rpp/18/"/>
      <updated>2020-07-17T12:00:00+00:00</updated>
      <summary>This week on the show we have Armin Ronacher to talk about the first 10 years of Flask. Armin talks about the origins of Flask and the components that make up the framework. He talks about what goes into documenting a framework or API. He also talks about the community working on the ongoing development of Flask.</summary>
      <content type="html">
        &lt;p&gt;This week on the show we have Armin Ronacher to talk about the first 10 years of Flask. Armin talks about the origins of Flask and the components that make up the framework. He talks about what goes into documenting a framework or API. He also talks about the community working on the ongoing development of Flask.&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>Grow Your Python Portfolio With 13 Intermediate Project Ideas</title>
      <id>https://realpython.com/courses/intermediate-project-ideas/</id>
      <link href="https://realpython.com/courses/intermediate-project-ideas/"/>
      <updated>2020-07-14T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how you can get started on 13 Python project ideas that are just right for intermediate Python developers. They&#x27;ll challenge you enough to help you become a better Pythonista but will still be doable!</summary>
      <content type="html">
        &lt;p&gt;Now that you know the basics of Python, you can put that knowledge to use by &lt;strong&gt;building projects&lt;/strong&gt; to put in your portfolio. The trick is finding project ideas that are just right for your level. Creating a variety of applications is a way to &lt;strong&gt;demonstrate your knowledge&lt;/strong&gt; and share it with others. &lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll get 13 project ideas that you can work on as an intermediate Python developer. The project ideas cover a wide range of application type and can be built using a command line, web based, or graphical user interface. You&amp;rsquo;ll see examples of existing applications for inspiration, and get links to Python libraries and resources to assist in your application development.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The importance of &lt;strong&gt;building projects&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;The major &lt;strong&gt;platforms&lt;/strong&gt; you can build projects for&lt;/li&gt;
&lt;li&gt;Thirteen &lt;strong&gt;project ideas&lt;/strong&gt; you can work on&lt;/li&gt;
&lt;li&gt;Some &lt;strong&gt;tips&lt;/strong&gt; for working on projects&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #17: Linear Programming, PySimpleGUI, and More</title>
      <id>https://realpython.com/podcasts/rpp/17/</id>
      <link href="https://realpython.com/podcasts/rpp/17/"/>
      <updated>2020-07-10T12:00:00+00:00</updated>
      <summary>Are you familiar with linear programming, and how it can be used to solve resource optimization problems? Would you like to free your Python code from a clunky command line and start making convenient graphical interfaces for your users? This week on the show, David Amos is back with another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Are you familiar with linear programming, and how it can be used to solve resource optimization problems? Would you like to free your Python code from a clunky command line and start making convenient graphical interfaces for your users? This week on the show, David Amos is back with 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>Pointers and Objects in Python</title>
      <id>https://realpython.com/courses/pointers-python/</id>
      <link href="https://realpython.com/courses/pointers-python/"/>
      <updated>2020-07-07T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about Python&#x27;s object model and see why pointers don&#x27;t really exist in Python. You&#x27;ll also cover ways to simulate pointers in Python without managing memory.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;ve ever worked with lower-level languages like C or C++, then you may have heard of &lt;strong&gt;pointers&lt;/strong&gt;. Pointers are essentially variables that hold the memory address of another variable. They allow you to create great efficiency in parts of your code but can lead to various memory management bugs.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll learn about &lt;strong&gt;Python&amp;rsquo;s object model&lt;/strong&gt; and see why pointers in Python don&amp;rsquo;t really exist. For the cases where you need to mimic pointer behavior, you&amp;rsquo;ll learn ways to simulate pointers in Python without managing memory.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn why &lt;strong&gt;pointers&lt;/strong&gt; in Python don&amp;rsquo;t exist&lt;/li&gt;
&lt;li&gt;Explore the difference between &lt;strong&gt;C variables&lt;/strong&gt; and &lt;strong&gt;Python names&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Simulate pointers&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Experiment with real pointers using &lt;strong&gt;&lt;code&gt;ctypes&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #16: Thinking in Pandas: Python Data Analysis the Right Way</title>
      <id>https://realpython.com/podcasts/rpp/16/</id>
      <link href="https://realpython.com/podcasts/rpp/16/"/>
      <updated>2020-07-03T12:00:00+00:00</updated>
      <summary>Are you using the Python library Pandas the right way? Do you wonder about getting better performance, or how to optimize your data for analysis? What does normalization mean?  This week on the show we have Hannah Stepanek to discuss her new book &quot;Thinking in Pandas&quot;.</summary>
      <content type="html">
        &lt;p&gt;Are you using the Python library Pandas the right way? Do you wonder about getting better performance, or how to optimize your data for analysis? What does normalization mean?  This week on the show we have Hannah Stepanek to discuss her new book &quot;Thinking in Pandas&quot;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Unicode in Python: Working With Character Encodings</title>
      <id>https://realpython.com/courses/python-unicode/</id>
      <link href="https://realpython.com/courses/python-unicode/"/>
      <updated>2020-06-30T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll get a Python-centric introduction to character encodings and Unicode. Handling character encodings and numbering systems can at times seem painful and complicated, but this guide is here to help with easy-to-follow Python examples.</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s &lt;strong&gt;Unicode&lt;/strong&gt; support is strong and robust, but it takes some time to master. There are many ways of encoding text into binary data, and in this course you&amp;rsquo;ll learn a bit of the history of encodings. You&amp;rsquo;ll also spend time learning the intricacies of Unicode, &lt;strong&gt;UTF-8&lt;/strong&gt;, and how to use them when programming Python. You&amp;rsquo;ll practice with multiple examples and see how smooth working with text and binary data in Python can be!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What an &lt;strong&gt;encoding&lt;/strong&gt; is&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;ASCII&lt;/strong&gt; is&lt;/li&gt;
&lt;li&gt;How binary displays as &lt;strong&gt;octal&lt;/strong&gt; and &lt;strong&gt;hex&lt;/strong&gt; values&lt;/li&gt;
&lt;li&gt;How UTF-8 encodes a &lt;strong&gt;code point&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to combine code points into a single &lt;strong&gt;glyph&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Which &lt;strong&gt;built-in functions&lt;/strong&gt; can help you&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #15: Python Regular Expressions, Views vs Copies in Pandas, and More</title>
      <id>https://realpython.com/podcasts/rpp/15/</id>
      <link href="https://realpython.com/podcasts/rpp/15/"/>
      <updated>2020-06-26T12:00:00+00:00</updated>
      <summary>Have you wanted to learn Regular Expressions in Python, but don&#x27;t know where to start? Have you stumbled into the dreaded pink SettingWithCopyWarning in Pandas? This week on the show, we have David Amos from the Real Python team to discuss a recent two-part series on Regex in Python. We also talk about another recent article on the site about views vs copies in Pandas. David also brings a few other articles and projects from the wider Python community for us to discuss.</summary>
      <content type="html">
        &lt;p&gt;Have you wanted to learn Regular Expressions in Python, but don&#x27;t know where to start? Have you stumbled into the dreaded pink SettingWithCopyWarning in Pandas? This week on the show, we have David Amos from the Real Python team to discuss a recent two-part series on Regex in Python. We also talk about another recent article on the site about views vs copies in Pandas. David also brings a few other articles and projects from the wider Python community for us to discuss.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Creating a Discord Bot in Python</title>
      <id>https://realpython.com/courses/discord-bot-python/</id>
      <link href="https://realpython.com/courses/discord-bot-python/"/>
      <updated>2020-06-23T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to make a Discord bot in Python and interact with several APIs. You&#x27;ll learn how to handle events, accept commands, validate and verify input, and all the basics that can help you create useful and exciting automations!</summary>
      <content type="html">
        &lt;p&gt;In a world where video games are so important to so many people, &lt;strong&gt;communication&lt;/strong&gt; and &lt;strong&gt;community&lt;/strong&gt; around games are vital. Discord offers both of those and more in one well-designed package. In this course, you&amp;rsquo;ll learn how to make a Discord bot in Python so that you can make the most of this fantastic platform.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;Discord&lt;/strong&gt; is and why it&amp;rsquo;s so valuable&lt;/li&gt;
&lt;li&gt;How to make a Discord bot through the &lt;strong&gt;Developer Portal&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to create &lt;strong&gt;Discord connections&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to handle &lt;strong&gt;events&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to accept &lt;strong&gt;commands&lt;/strong&gt; and &lt;strong&gt;validate assumptions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to interact with various &lt;strong&gt;Discord APIs&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>
  

</feed>
