Issue #693: Nested Functions, Bitwise Operators, Virtual Threads, and More (Aug. 5, 2025)

#693 – AUGUST 5, 2025

Nested Functions in Python

Functions in Python can be defined within another function, this post shows you how and just why you might do that.
TREY HUNNER

Bitwise Operators in Python

Learn how to use Python’s bitwise operators to manipulate individual bits of data at the most granular level.
REAL PYTHON

Quiz: Bitwise Operators in Python

REAL PYTHON

Prevent Postgres Slowdowns on Python Apps With This Check List

Avoid performance regressions in your Python app by staying on top of Postgres maintenance. This monthly check list outlines what to monitor, how to catch slow queries early, and ways to ensure indexes, autovacuum, and I/O are performing as expected →
PGANALYZE sponsor

From Async/Await to Virtual Threads

In this opinion piece, Armin describes how he wishes async in Python would work.
ARMIN RONACHER

Narwhals v2.0.0 Released

GITHUB.COM/NARWHALS-DEV

Mypy 1.17 Released

MYPY-LANG.BLOGSPOT.COM

PEP 798: Unpacking in Comprehensions (Added)

PYTHON.ORG

PEP 799: A Dedicated Profilers Package for Organizing Python Profiling Tools (Added)

PYTHON.ORG

Discussions

What’s the Point of Try/Except Just to Raise the Exception?

REDDIT

Articles & Tutorials

PyPI Users Email Phishing Attack

PyPI users are being targeted by an email phishing attack attempting to trick them into logging into a fake PyPI site. This post from the Security Engineer at PyPI discusses what is happening and what you should do about it. There is also a follow-up post.
MIKE FIEDLER

Smuggling Arbitrary Data Through an Emoji

Unicode includes flexibility through the use of Variation Selectors. These include the ability to change characters through a consecutive series of coding points. But, when used with code points that don’t need them, they’re ignored, so you can hide data in them.
PAUL BUTLER

Introducing an Intuitive IDE for Code and Data

Positron offers an intuitive environment for exploring data, plots, apps, and connections within your IDE.
POSIT sponsor

Creating an XML Editor With Textual

Several years ago, Mike created an XML editor with the wxPython GUI toolkit called Boomslang. Recently he ported it to Textual and this post gives you step by step instructions on how to create your own.
MIKE DRISCOLL

Stop Using Django’s squashmigrations

Squashing merges multiple database migrations into a single consolidated file to speed up database setup and tidy up history. Learn why it is sometimes problematic and what else you can do.
JOHNNY METZ

When to Use Classes in Python?

Having trouble figuring out when to use classes? This article looks at another heuristic for using classes in Python, with examples from real-world code, and some things to keep in mind.
ADRIAN

Faster Python: Unlocking the Python Global Interpreter Lock

Take a look at true multithreading in Python 3.13 with the no-GIL option. Learn why it matters and compare performance with and without the Global Interpreter Lock.
CHEUK TING HO

TIL: Exception.add_note()

A quick “Thing I Learned” article showing the .add_note() methods on Exceptions and how you can provide more information when something goes wrong.
DANIEL ROY GREENFELD

metap: A Meta-Programming Layer for Python

metap is a meta-programming layer for Python. It is useful for automating coding patterns or applying transformations to your code.
BAZIOTIS & MENDIS

Working With Python’s Built-in Exceptions

Learn the most common built-in Python exceptions, when they occur, how to handle them, and how to raise them properly in your code.
REAL PYTHON course

Coverage.py regex pragmas

Coverage.py uses regexes to define pragma syntax. This is surprisingly powerful, allowing for custom exclusions and plugins.
NED BATCHELDER

Following Up on the Python JIT

A summary of the current state of the JIT compiler inside CPython based on a couple of talks from one of the creators.
JAKE EDGE

Don’t Call Dunder Methods

It’s best to avoid calling dunder methods. It’s common to define dunder methods, but uncommon to call them directly.
TREY HUNNER

Projects & Code

abogen: Generate Audiobooks From EPUBs & PDFs

GITHUB.COM/DENIZSAFAK

Otary: 2D Geometry Python Library

GITHUB.COM/POUPEAUA • Shared by Alexandre Poupeau

Free-Threaded Map-Reduce

GITHUB.COM/JOSEBLANCA • Shared by Jose Blanca

transfunctions: Support Both Sync and Async

GITHUB.COM/POMPONCHIK • Shared by pomponchik (Evgeniy Blinov)

octopusdash: Dynamic Django Admin Panel

GITHUB.COM/HUSSEINNAEEMSEC

Events

Weekly Real Python Office Hours Q&A (Virtual)

August 6, 2025
REALPYTHON.COM

Canberra Python Meetup

August 7, 2025
MEETUP.COM

Sydney Python User Group (SyPy)

August 7, 2025
SYPY.ORG

Buea

August 8 to August 9, 2025
NOKIDBEHIND.ORG

PyDelhi User Group Meetup

August 9, 2025
MEETUP.COM

DFW Pythoneers 2nd Saturday Teaching Meeting

August 9, 2025
MEETUP.COM

DjangoCon Africa 2025

August 11 to August 16, 2025
DJANGOCON.AFRICA

PyCon Somalia 2025

August 13 to August 15, 2025
PYCON.ORG.SO

PyCon Korea 2025

August 15 to August 18, 2025
PYCON.KR

Happy Pythoning!
This was PyCoder’s Weekly Issue #693.
View in Browser »

[ Subscribe to 🐍 PyCoder’s Weekly 💌 – Get the best Python news, articles, and tutorials delivered to your inbox once a week >> Click here to learn more ]

Source:: PyCoder’s