Real Python Podcast Episode #139 Title Artwork

Episode 139: Surveying Comprehension Constructs & Python Parallelism Infighting

The Real Python Podcast

Jan 06, 2023 44m

Have you embraced the use of comprehensions in your Python journey? Are you familiar with all the varieties of comprehension constructs? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects.

Episode Sponsor:

We discuss a recent article that surveys Python’s comprehensions and generators. This overview includes code snippets and the fundamentals of creating list, set, and dictionary comprehensions. We weigh the advantages of using a comprehension versus the more familiar for loops that they replace.

Christopher shares an article about how there may be infighting between the parallelism in your Python code and the parallelism within the libraries that you’re using. These complex system interactions can cause processing slowdowns and hard-to-trace bottlenecks.

We share several other articles and projects from the Python community, including a news roundup, a Python linter comparison, an overview of multiprocessing race conditions in Python, a discussion covering import statement styles, a project for WASM-powered Jupyter tools running in the browser, and a collection of easter eggs and jokes hidden inside Python itself.

Topics:

  • 00:00:00 – Introduction
  • 00:02:41 – PyPy v7.3.10 Release
  • 00:03:17 – Django Bugfix Release: 4.1.4
  • 00:03:28 – Python 3.11.1, 3.10.9, 3.9.16, 3.8.16, 3.7.16 Released
  • 00:03:56 – Python Linter Comparison 2022
  • 00:11:51 – Who Controls Parallelism? A Disagreement That Leads to Slower Code
  • 00:15:58 – Sponsor: InfluxDB
  • 00:16:47 – A Crash Course in Comprehensions and Generators
  • 00:24:23 – Multiprocessing Race Conditions in Python
  • 00:27:46 – Video Course Spotlight
  • 00:28:55 – What Style of import Statement Do You Use?
  • 00:36:54 – jupyterlite: WASM Powered Jupyter Running in the Browser
  • 00:40:35 – python-easter-eggs: Easter Eggs and Hidden Jokes in Python
  • 00:43:18 – PyCoder’s Weekly: Submit a Link
  • 00:43:46 – Thanks and goodbye

News:

Show Links:

  • Python Linter Comparison 2022 – There are many linter choices for Python. This article covers a lot of them: Pylint, Pyflakes, Flake8, autopep8, Bandit, Prospector, Pylama, Pyroma, Black, Mypy, Radon, and mccabe.
  • Who Controls Parallelism? A Disagreement That Leads to Slower Code – In complex systems, there may be a fight between the parallelism in your code vs the parallelism in the libraries that you’re using. This fight can cause things to slow down. This article shows some examples and explores what you can do about the issue.
  • A Crash Course in Comprehensions and Generators – A great collection of code snippets that showcase the power and flexibility of list comprehensions, generators, and related constructs.
  • Multiprocessing Race Conditions in Python – A race condition happens when parallel tasks attempt to execute code at the same time and the results are dependent on order of execution. Finding race conditions can be challenging. This article gives some hints as to how to find the different kinds of race conditions when coding with the multiprocessing module.

Discussion:

Projects:

Additional Links:

Level Up Your Python Skills With These Courses: