#626 – APRIL 23, 2024
Asyncio Handle Control-C (SIGINT)
When the user presses CTRL-C on the keyboard, the OS raises an interrupt signal to your program. When writing concurrent code this can get complicated as the signal goes to the process. This article shows you how to handle capturing CTRL-C elegantly when using asyncio
.
JASON BROWNLEE
Using raise
for Effective Exceptions
In this video course, you’ll learn how to raise exceptions in Python, which will improve your ability to efficiently handle errors and exceptional situations in your code. This way, you’ll write more reliable, robust, and maintainable code.
REAL PYTHON course
Securing Python and Open Source Ecosystems
Join this fireside chat featuring Dustin Ingram, Fellow at the Python Software Foundation (PSF), as we discuss trust and security for PyPI and other repositories in light of recent attacks, and initiatives such as Trusted Publishing – Tune in this Thursday! →
ACTIVESTATE sponsor
Ruff Gets a Big Speed-Up
Ruff has changed from a generated parser to a hand-written recursive descent parser in the latest release. This has resulted in >2x speedup in its linting performance. This article covers what has changed and why they did it.
DHRUV MANILAWALA
Quiz: Managing Multiple Python Versions With pyenv
REAL PYTHON
Articles & Tutorials
OpenStreetMaps, Overpass API and Python
OpenStreetMaps (OSM) is an an open source mapping project that allows people to browse the world map and to plan routes. Not only does it have the expected web interface, but it also has an API known as Overpass. This article shows you two ways to use Python to query Overpass.
JUDITH VOCKENROTH
Python Gotcha: strip
Can Remove More Than Expected
The Python strip
, lstrip
, and rstrip
functions can have unexpected behavior: they strip a list of characters, not strings. Even though this is documented, it can lead to unexpected results. This post explains what happens and shows you two functions to use instead.
ANDREW WEGNER
Decoupling Systems to Get Closer to the Data
What are the benefits of using a decoupled data processing system? How do you write reusable queries for a variety of backend data platforms? This week on the show, Phillip Cloud, the lead maintainer of Ibis, will discuss this portable Python dataframe library.
REAL PYTHON podcast
Announcing py2wasm
: A Python to Wasm Compiler
Wasmer, a company that builds Wasm tools, has announced py2wasm
which converts your Python programs to WebAssembly, running at 3x faster speeds than direct Wasm. This post introduces you to the tool and shows how they took advantage of the Nuitka library.
SYRUS AKBARY
How to Format Floats Within F-Strings in Python
In this tutorial, you’ll learn how to use Python format specifiers within an f-string to allow you to neatly format a float to your required precision. You’ll also learn how to extract digits from existing strings and format them as well.
REAL PYTHON
Memory Management in mpmetrics
The mpmetrics
library contains tools for determining runtime metrics on your code. To do this it requires some esoteric memory management techniques normally not undergone in Python. This post describe what they’ve done and why.
TRENDS BLOG
The Time Complexities Python Data Structures in Python
Big O notation describes the relationship between an algorithm, how much data it is using, and the time it takes to run. This article covers the time complexities of a variety of Python data structures.
TREY HUNNER
Django Project on NGINX Unit
Unit is a web server developed by the NGINX folks with pluggable support for Python using WSGI and ASGI. Aidas tried it out and this post talks about how he got some Django code working on this server.
AIDAS BENDORAITIS
I Asked 100 Devs Why They Aren’t Shipping Faster?
Daksh asked 100 developers why they aren’t shipping faster and this blog post shares what he learned. Problems include dependency bugs, overly complicated code bases, waiting on requirements, and more.
DAKSH GUPTA
Shape Typing in Python
This quick blog post shows you how to use Python type checking to ensure the dimensions of matrices being multiplied together. Typing is no longer just “is it an integer”.
JAMES FISHER
Software Needs to Be More Expensive
Open source is free, and although that is a good thing, it also means companies get to take without giving back. This opinion piece talks about how that should change.
GLYPH LEFKOWITZ
Projects & Code
Master Python With Spaced Repetition
PYTHON CARDS
automathon: Simulate and Visualize Finite Automata
GITHUB.COM/ROHAQUINLOP
stamina: Production-Grade Retries for Python
GITHUB.COM/HYNEK
tenacity: Retrying Library for Python
GITHUB.COM/JD
auto_venv: Say Goodbye to Manual Setup or Install
GITHUB.COM/AMAL-KHAILTASH
escaping: Suppress Exceptions With Callbacks and Logs
GITHUB.COM/POMPONCHIK • Shared by Evgeniy Blinov
Events
Weekly Real Python Office Hours Q&A (Virtual)
April 24, 2024
REALPYTHON.COM
SPb Python Drinkup
April 25, 2024
MEETUP.COM
Django Girls Ekpoma Workshop
April 26 to April 28, 2024
DJANGOGIRLS.ORG
Open Source With Python
April 27, 2024
MEETUP.COM
PythOnRio Meetup
April 27, 2024
PYTHON.ORG.BR
Launching Python Niger
April 28 to April 29, 2024
FB.ME
Happy Pythoning!
This was PyCoder’s Weekly Issue #626.
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