<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>PyVideo.org - Python Morsels</title><link>https://pyvideo.org/</link><description></description><lastBuildDate>Mon, 10 Oct 2022 00:00:00 +0000</lastBuildDate><item><title>Unindenting multi-line strings in Python</title><link>https://pyvideo.org/python-morsels/dedent.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Need a multi-line string but don't want to include a big block of manually dedented text in your Python code? Use textwrap.dedent!&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 10 Oct 2022 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2022-10-10:/python-morsels/dedent.html</guid><category>Python Morsels</category><category>Strings</category></item><item><title>Reading binary files in Python</title><link>https://pyvideo.org/python-morsels/reading-binary-files-in-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;How can you read binary files in Python? And how can you read very large binary files in small chunks?&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 16 May 2022 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2022-05-16:/python-morsels/reading-binary-files-in-python.html</guid><category>Python Morsels</category><category>Files</category></item><item><title>Unicode character encodings</title><link>https://pyvideo.org/python-morsels/unicode-character-encodings-in-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;When working with text files in Python, it's considered a best practice to specify the character encoding that you're working with.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 02 May 2022 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2022-05-02:/python-morsels/unicode-character-encodings-in-python.html</guid><category>Python Morsels</category><category>Files</category></item><item><title>What is an iterator?</title><link>https://pyvideo.org/python-morsels/what-is-an-iterator.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Iterators are lazy iterables which power all iteration in Python. Iterators are the generic form of a generator-like object.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 14 Mar 2022 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2022-03-14:/python-morsels/what-is-an-iterator.html</guid><category>Python Morsels</category><category>Generator Function</category></item><item><title>How to create a generator function</title><link>https://pyvideo.org/python-morsels/how-to-create-a-generator-function.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Have a function that returns a list? You may be able to turn it into a generator function by replacing the &lt;cite&gt;append&lt;/cite&gt; calls with &lt;cite&gt;yield&lt;/cite&gt; statements.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 07 Mar 2022 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2022-03-07:/python-morsels/how-to-create-a-generator-function.html</guid><category>Python Morsels</category><category>Generator Function</category></item><item><title>What is a generator function?</title><link>https://pyvideo.org/python-morsels/what-is-a-generator-function.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;When you call a generator function it doesn't actually run the function; instead it returns a generator object.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 28 Feb 2022 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2022-02-28:/python-morsels/what-is-a-generator-function.html</guid><category>Python Morsels</category><category>Generator Function</category></item><item><title>How to read a traceback in Python</title><link>https://pyvideo.org/python-morsels/reading-tracebacks-in-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;When exceptions go unhandled, Python prints a traceback. Tracebacks are &lt;strong&gt;read from the bottom upward&lt;/strong&gt;. The last line describes &lt;em&gt;what&lt;/em&gt; happened and lines above describe &lt;em&gt;where&lt;/em&gt; it happened.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 03 Jan 2022 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2022-01-03:/python-morsels/reading-tracebacks-in-python.html</guid><category>Python Morsels</category><category>Exception</category></item><item><title>Modules are cached</title><link>https://pyvideo.org/python-morsels/modules-are-cached.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;When re-importing a module Python will use the cached version of your module (instead of reevaluating your code). To refresh a module while in the Python REPL, it's best to exit and start a new REPL.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 01 Nov 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-11-01:/python-morsels/modules-are-cached.html</guid><category>Python Morsels</category><category>Modules</category></item><item><title>How to write to a file in Python</title><link>https://pyvideo.org/python-morsels/creating-and-writing-file-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;To write to a file in Python, you can use the built-in &lt;cite&gt;open&lt;/cite&gt; function, specifying a mode of &lt;cite&gt;w&lt;/cite&gt; or &lt;cite&gt;wt&lt;/cite&gt; and then use the &lt;cite&gt;write&lt;/cite&gt; method on the file object.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 18 Oct 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-10-18:/python-morsels/creating-and-writing-file-python.html</guid><category>Python Morsels</category><category>Files</category></item><item><title>Read a file line-by-line in Python</title><link>https://pyvideo.org/python-morsels/reading-files-line-line.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;When Python reads a file line-by-line, it doesn't store the whole file in memory all at once. Files are lazy iterables, and as we loop over a file object, we'll get lines from that file.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 11 Oct 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-10-11:/python-morsels/reading-files-line-line.html</guid><category>Python Morsels</category><category>Files</category></item><item><title>How to read from a text file</title><link>https://pyvideo.org/python-morsels/how-read-text-file.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;To work with a text file in Python, you can use the built-in open function, which gives you back a file object. Reading from and writing to text files is an important skill.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 04 Oct 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-10-04:/python-morsels/how-read-text-file.html</guid><category>Python Morsels</category><category>Files</category></item><item><title>Defining a main function in Python</title><link>https://pyvideo.org/python-morsels/making-main-function-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;How can you setup a main function in Python? And should you? Python doesn't know about main functions, but there's nothing stopping us from defining a function called main that we only call when running from the command-line.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 27 Sep 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-09-27:/python-morsels/making-main-function-python.html</guid><category>Python Morsels</category><category>Command Line Interfaces</category></item><item><title>Importing a module runs code</title><link>https://pyvideo.org/python-morsels/importing-module-runs-code.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;When Python imports a module, it runs all the code in that module.
So if your Python file is meant to be imported as a module, be careful not to put side effects at the top-level of your &lt;cite&gt;.py&lt;/cite&gt; file.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 13 Sep 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-09-13:/python-morsels/importing-module-runs-code.html</guid><category>Python Morsels</category><category>Modules</category></item><item><title>Parsing command-line arguments in Python</title><link>https://pyvideo.org/python-morsels/parsing-command-line-arguments-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;If you're trying to make a friendly command-line interface in Python, instead of manually parsing sys.argv you should probably use Python's argparse module.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 06 Sep 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-09-06:/python-morsels/parsing-command-line-arguments-python.html</guid><category>Python Morsels</category><category>Command Line Interfaces</category></item><item><title>Accessing command-line arguments in Python</title><link>https://pyvideo.org/python-morsels/accessing-command-line-arguments-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;If you need to make a very simple command-line interface and it doesn't need to be friendly, you can read sys.argv to manually process the arguments coming into your program.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 30 Aug 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-08-30:/python-morsels/accessing-command-line-arguments-python.html</guid><category>Python Morsels</category><category>Command Line Interfaces</category></item><item><title>Python's walrus operator</title><link>https://pyvideo.org/python-morsels/using-walrus-operator.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Python's &amp;quot;walrus operator&amp;quot; is used for assignment expressions. Assignment expressions are a way of embedding an assignment statement inside another line of code.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 16 Aug 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-08-16:/python-morsels/using-walrus-operator.html</guid><category>Python Morsels</category></item><item><title>Customizing what happens when you assign an attribute</title><link>https://pyvideo.org/python-morsels/customizing-what-happens-when-you-assign-attribute.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Want to customize what happens when you assign to a specific attribute on your class instances? You can use a property with a setter.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Sun, 08 Aug 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-08-08:/python-morsels/customizing-what-happens-when-you-assign-attribute.html</guid><category>Python Morsels</category><category>Properties</category></item><item><title>Making a read-only attribute</title><link>https://pyvideo.org/python-morsels/making-read-only-attribute.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;If you need to make a read-only attribute in Python, you can turn your attribute into a property that delegates to an attribute with almost the same name (but with an underscore prefix).&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 03 Aug 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-08-03:/python-morsels/making-read-only-attribute.html</guid><category>Python Morsels</category><category>Properties</category></item><item><title>Python's map and filter functions</title><link>https://pyvideo.org/python-morsels/map-and-filter-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;How do Python's built-in map and filter functions work? And should you use them or should you use list comprehensions or generator expressions instead?&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 26 Jul 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-07-26:/python-morsels/map-and-filter-python.html</guid><category>Python Morsels</category><category>Generator Expression</category></item><item><title>How to write a generator expression</title><link>https://pyvideo.org/python-morsels/how-write-generator-expression.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;List comprehensions make lists; generator expressions make generators. Generators are lazy single-use iterables which generate values as you loop over them.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 13 Jul 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-07-13:/python-morsels/how-write-generator-expression.html</guid><category>Python Morsels</category><category>Generator Expression</category></item><item><title>How to make a decorator</title><link>https://pyvideo.org/python-morsels/make-decorator.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;A decorator is a function that accepts a function and returns a function. That's true for function decorators at least.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 14 Jun 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-06-14:/python-morsels/make-decorator.html</guid><category>Python Morsels</category><category>Decorators</category></item><item><title>What is a decorator?</title><link>https://pyvideo.org/python-morsels/what-is-a-decorator.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;A decorator is a callable (usually a function though sometimes a class) that accepts either a function or a class and returns a new function or class that wraps around the original one.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Wed, 09 Jun 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-06-09:/python-morsels/what-is-a-decorator.html</guid><category>Python Morsels</category><category>Decorators</category></item><item><title>Passing functions as arguments to other functions</title><link>https://pyvideo.org/python-morsels/passing-functions-arguments-other-functions.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;In Python, you can pass functions (as an argument) to another function. Some of Python's built-in functions actually expect functions to be given as one or more of their arguments to call them later.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Thu, 03 Jun 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-06-03:/python-morsels/passing-functions-arguments-other-functions.html</guid><category>Python Morsels</category><category>Decorators</category></item><item><title>The meaning of "callable" in Python</title><link>https://pyvideo.org/python-morsels/callables.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;A callable is a function-like object, meaning it's something that behaves like a function. The primary types of callables in Python are functions and classes, though other callable objects do exist.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Fri, 28 May 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-05-28:/python-morsels/callables.html</guid><category>Python Morsels</category><category>Decorators</category></item><item><title>Turning a for loop into a list comprehension</title><link>https://pyvideo.org/python-morsels/turning-loop-list-comprehension.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;If you're new to comprehensions, I recommend copy-pasting your way from a loop to comprehension to anchor your existing understanding of &lt;cite&gt;for&lt;/cite&gt; loops with your new knowledge of comprehensions.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 18 May 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-05-18:/python-morsels/turning-loop-list-comprehension.html</guid><category>Python Morsels</category><category>Comprehensions</category></item><item><title>Breaking up long lines of code in Python</title><link>https://pyvideo.org/python-morsels/breaking-long-lines-code-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Have a long line of code? If you don't have brackets or braces on your line yet, you can add parentheses wherever you'd like and put line breaks within them. We call this &amp;quot;implicit line continuation&amp;quot;.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Thu, 06 May 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-05-06:/python-morsels/breaking-long-lines-code-python.html</guid><category>Python Morsels</category><category>Fundamentals</category></item><item><title>List comprehensions in Python</title><link>https://pyvideo.org/python-morsels/what-are-list-comprehensions.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Python's list comprehensions are special-purpose tools for taking an old iterable, looping over it, and making a new list out of it.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Wed, 28 Apr 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-04-28:/python-morsels/what-are-list-comprehensions.html</guid><category>Python Morsels</category><category>Comprehensions</category></item><item><title>4 ways to import a module in Python</title><link>https://pyvideo.org/python-morsels/4-ways-import-module-python.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;In Python you can import specific variables from a module, you can import the whole module, and you can also rename variables while importing. When should you use each of these import styles?&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Wed, 21 Apr 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-04-21:/python-morsels/4-ways-import-module-python.html</guid><category>Python Morsels</category><category>Modules</category></item><item><title>Making an auto-updating attribute</title><link>https://pyvideo.org/python-morsels/making-auto-updating-attribute.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;We don't use getter methods in Python, instead we use the property decorator to make make automatically updating attributes. Properties allow us to customize what happens when you access an attribute.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 20 Apr 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-04-20:/python-morsels/making-auto-updating-attribute.html</guid><category>Python Morsels</category><category>Properties</category></item><item><title>Tuple unpacking</title><link>https://pyvideo.org/python-morsels/tuple-unpacking.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Instead of using hard-coded indices to get tuple elements, use tuple unpacking to give descriptive names to each item. Important items should have a name instead of a number.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Thu, 25 Mar 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-03-25:/python-morsels/tuple-unpacking.html</guid><category>Python Morsels</category><category>Tuple Unpacking</category></item><item><title>Importing a module in Python</title><link>https://pyvideo.org/python-morsels/importing-module.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;When you import a module in Python, you'll get access to a module object with attributes representing each of the variables in that module. Python comes bundled with a bunch of modules.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Thu, 18 Mar 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-03-18:/python-morsels/importing-module.html</guid><category>Python Morsels</category><category>Modules</category></item><item><title>Inheriting one class from another</title><link>https://pyvideo.org/python-morsels/inheriting-one-class-another.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;To inherit your class from another class, put parentheses after the class name and list parent classes. We allow multiple inheritance in Python, but we usually prefer single class inheritance.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Thu, 04 Mar 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-03-04:/python-morsels/inheriting-one-class-another.html</guid><category>Python Morsels</category><category>Classes</category><category>Inheritance</category></item><item><title>__init__ in Python</title><link>https://pyvideo.org/python-morsels/what-is-init.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;The &lt;cite&gt;__init__&lt;/cite&gt; method is used to initialize a class. The initializer method accepts self (the class instance) along with any arguments the class accepts and then performs initialization steps.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Thu, 11 Feb 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-02-11:/python-morsels/what-is-init.html</guid><category>Python Morsels</category><category>Classes</category></item><item><title>Customizing the string representation of your objects</title><link>https://pyvideo.org/python-morsels/customizing-string-representation-your-objects.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;You'll almost always just want to customize one of Python's two string representations (&lt;cite&gt;repr&lt;/cite&gt;, the programmer readable-one). The human-readable representation (&lt;cite&gt;str&lt;/cite&gt;) delegates to &lt;cite&gt;repr&lt;/cite&gt; by default.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Fri, 22 Jan 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-01-22:/python-morsels/customizing-string-representation-your-objects.html</guid><category>Python Morsels</category><category>Dunder Methods</category></item><item><title>Dunder methods in Python</title><link>https://pyvideo.org/python-morsels/what-are-dunder-methods.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Dunder methods power most operators in Python as well as some of the built-in functions. Dunder methods are a contract between the person who made a class and Python itself.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 05 Jan 2021 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2021-01-05:/python-morsels/what-are-dunder-methods.html</guid><category>Python Morsels</category><category>Dunder Methods</category></item><item><title>Python's 2 different string representations</title><link>https://pyvideo.org/python-morsels/pythons-two-different-string-representations.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;In Python, we have two different string representations: the human-readable string representation and the programmer-readable string representation (called repr and str respectively).&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Wed, 30 Dec 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-12-30:/python-morsels/pythons-two-different-string-representations.html</guid><category>Python Morsels</category><category>Strings</category></item><item><title>Python's self</title><link>https://pyvideo.org/python-morsels/what-is-self.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Python's &lt;cite&gt;self&lt;/cite&gt; is really just a variable that points to the current instance of our class. Every method you define must accept &lt;cite&gt;self&lt;/cite&gt; as its first argument.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 28 Dec 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-12-28:/python-morsels/what-is-self.html</guid><category>Python Morsels</category><category>Classes</category></item><item><title>Classes are everywhere</title><link>https://pyvideo.org/python-morsels/classes-are-everywhere.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Even if you never make your class, you will certainly use classes. A lot of the built-in functions in Python are classes too. Anything that has a type has a class.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 22 Dec 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-12-22:/python-morsels/classes-are-everywhere.html</guid><category>Python Morsels</category><category>Classes</category></item><item><title>What is a class?</title><link>https://pyvideo.org/python-morsels/what-is-a-class.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Classes are for coupling state (attributes) and functionality (methods). Calling a class returns an instance of that class. Class and &amp;quot;type&amp;quot; are synonyms in Python.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Wed, 09 Dec 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-12-09:/python-morsels/what-is-a-class.html</guid><category>Python Morsels</category><category>Classes</category></item><item><title>Accepting arbitrary keyword arguments in Python</title><link>https://pyvideo.org/python-morsels/accepting-arbitrary-keyword-arguments.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Ever seen &lt;cite&gt;**kwargs&lt;/cite&gt; in a function definition? There's nothing special about the name &amp;quot;kwargs&amp;quot;: it's the &lt;cite&gt;**&lt;/cite&gt; that's special. You can use Python's &lt;cite&gt;**&lt;/cite&gt; operator to define a function that accepts arbitrary keyword arguments.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Fri, 04 Dec 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-12-04:/python-morsels/accepting-arbitrary-keyword-arguments.html</guid><category>Python Morsels</category><category>Functions</category><category>Asterisks</category></item><item><title>Keyword-only function arguments</title><link>https://pyvideo.org/python-morsels/keyword-only-function-arguments.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;If you see a function that has an asterisk (&lt;cite&gt;*&lt;/cite&gt;) on its own with a comma after it, every argument after that point is a keyword-only argument (an argument which can only be specified by its name).&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 30 Nov 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-11-30:/python-morsels/keyword-only-function-arguments.html</guid><category>Python Morsels</category><category>Functions</category><category>Asterisks</category></item><item><title>Accepting any number of arguments to a function</title><link>https://pyvideo.org/python-morsels/accepting-any-number-arguments-function.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;To make a function that accepts any number of arguments, you can use the &lt;cite&gt;*&lt;/cite&gt; operator and then some variable name when defining your function. Some of Python's built-in functions work this way.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Wed, 18 Nov 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-11-18:/python-morsels/accepting-any-number-arguments-function.html</guid><category>Python Morsels</category><category>Functions</category><category>Asterisks</category></item><item><title>How to make a function</title><link>https://pyvideo.org/python-morsels/making-a-function.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;To define a function in Python, use the def keyword with the function name and any accepted arguments (in parentheses). Functions have inputs (arguments) and an optional output (the return value).&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Mon, 16 Nov 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-11-16:/python-morsels/making-a-function.html</guid><category>Python Morsels</category><category>Functions</category></item><item><title>Positional vs keyword arguments</title><link>https://pyvideo.org/python-morsels/positional-vs-keyword-arguments.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;When you're working with named arguments (a.k.a. keyword arguments) it's the argument name that matters. When you're working with positional arguments, it's the position matters (but not the name).&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Thu, 12 Nov 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-11-12:/python-morsels/positional-vs-keyword-arguments.html</guid><category>Python Morsels</category><category>Functions</category></item><item><title>How to call a function in Python</title><link>https://pyvideo.org/python-morsels/calling-a-function.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;To use a function in Python, write the function name followed by parentheses. If the function accepts arguments, pass the arguments inside the parentheses.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Wed, 11 Nov 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-11-11:/python-morsels/calling-a-function.html</guid><category>Python Morsels</category><category>Functions</category></item><item><title>Looping over multiple iterables at once</title><link>https://pyvideo.org/python-morsels/looping-over-multiple-iterables.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Need to loop over two (or more) iterables at the same time? Don't use range. Don't use enumerate. Use the built-in zip function. As you loop over zip you'll get the n-th item from each iterable.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 13 Oct 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-10-13:/python-morsels/looping-over-multiple-iterables.html</guid><category>Python Morsels</category><category>Looping</category></item><item><title>Looping with indexes</title><link>https://pyvideo.org/python-morsels/looping-with-indexes.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Python's built-in enumerate function is the preferred way to loop while counting upward at the same time. You'll almost always see tuple unpacking used whenever enumerate is used.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Thu, 08 Oct 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-10-08:/python-morsels/looping-with-indexes.html</guid><category>Python Morsels</category><category>Looping</category></item><item><title>What is an iterable?</title><link>https://pyvideo.org/python-morsels/iterable.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;An iterable is anything you're able to iterate over (iter-&lt;em&gt;able&lt;/em&gt;). Iterables can be looped over and anything you can loop over is an iterable. Not every iterable is indexable or has a length.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 06 Oct 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-10-06:/python-morsels/iterable.html</guid><category>Python Morsels</category><category>Looping</category></item><item><title>Writing a for loop</title><link>https://pyvideo.org/python-morsels/writing-a-for-loop.html</link><description>&lt;h3&gt;Description&lt;/h3&gt;&lt;p&gt;Unlike traditional C-style for loops, Python's for loops don't have indexes. It's considered a best practice to avoid reaching for indexes unless you really need them.&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Trey Hunner</dc:creator><pubDate>Tue, 29 Sep 2020 00:00:00 +0000</pubDate><guid isPermaLink="false">tag:pyvideo.org,2020-09-29:/python-morsels/writing-a-for-loop.html</guid><category>Python Morsels</category><category>Looping</category></item></channel></rss>