Have you ever encountered strange behavior when trying something new in Python? What are common quirks hiding within the language? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects.

We discuss a recent blog post that lists a collection of quirky Python behaviors. We share a few examples with explanations but leave several as puzzles to dig into.

Christopher transitions our discussion into Python features that can be difficult to explain to a new programmer. We also share some of our own stumbling blocks while learning the language.

We cover several other articles and projects from the Python community, including a news update, previewing Python 3.12’s more intuitive and consistent f-strings, finding performance bottlenecks with profiling, emulating the 6502 processor in Python, using Rich to inspect Python objects, and plotting statistical data with Lets-Plot.

This week’s episode is brought to you by Porkbun.

Course Spotlight: Graph Your Data With Python and ggplot

In this course, you’ll learn how to use ggplot in Python to build data visualizations with plotnine. You’ll discover what a grammar of graphics is and how it can help you create plots in a very concise and consistent way.

Topics:

  • 00:00:00 – Introduction
  • 00:02:12 – Steering Council Announces Optional GIL
  • 00:04:05 – Polars is Starting a Company
  • 00:05:13 – Python 3.12 Preview: More Intuitive and Consistent F-Strings
  • 00:09:29 – Sponsor: Porkbun
  • 00:10:22 – Profiling in Python: How to Find Performance Bottlenecks
  • 00:21:01 – Writing a 6502 Emulator in Python
  • 00:24:36 – Python Quirks
  • 00:32:30 – Video Course Spotlight
  • 00:34:02 – What Python feature would you have trouble explaining to a new programmer?
  • 00:42:25 – Using Rich Inspect to Interrogate Python Objects
  • 00:44:36 – Lets-Plot: Plotting Library for Statistical Data
  • 00:48:01 – Thanks and goodbye

News:

Show Links:

  • Python 3.12 Preview: More Intuitive and Consistent F-Strings – In this tutorial, you’ll preview one of the upcoming features of Python 3.12, which introduces a new f-string syntax formalization and implementation. The new implementation lifts some restrictions and limitations that affect f-string literals in Python versions lower than 3.12.
  • Profiling in Python: How to Find Performance Bottlenecks – In this tutorial, you’ll learn how to profile your Python programs using numerous tools available in the standard library, third-party libraries, as well as a powerful tool foreign to Python. Along the way, you’ll learn what profiling is and cover a few related concepts.
  • Writing a 6502 Emulator in Python – The 6502 processor from Motorola was quite popular and could be found in the Nintendo and Sega consoles as well as the Commodore 64. This very detailed article shows you how to build an emulator for the processor in Python.
  • Python Quirks – A straight-out list of code snippets showing off some of the weird and unexpected behavior of your favorite language.

Discussion

Projects:

Additional Links:

Level up your Python skills with our expert-led courses:

Support the podcast & join our community of Pythonistas