Issue #509

PEP 646 Accepted, Strict Function Parameters, Solving Wordle, and More

Jan. 25, 2022

PEP 646 Accepted, Strict Function Parameters, Solving Wordle, and More
#509 – JANUARY 25, 2022 VIEW IN BROWSER
The PyCoder’s Weekly Logo
PEP 646: Variadic Generics Was Accepted
This PEP introduces TypeVarTuple, enabling parameterisation with an arbitrary number of types. For example, it allows the type of array-like structures in numerical computing libraries such as NumPy and TensorFlow to be parameterised with the array shape, enabling static type checkers to catch shape-related bugs. The PEP was recently accepted by the Steering Council.
PYTHON.ORG

Build a Dice-Rolling Application With Python
In this step-by-step project, you’ll build a dice-rolling simulator app with a minimal text-based user interface using Python. The app will simulate the rolling of up to six dice. Each individual die will have six sides.
REAL PYTHON

How to Quickly Label Data for Machine Learning
With Toloka, you can control the accuracy and speed of data labeling to develop high performing ML models. Our platform supports annotation for image classification, semantic segmentation, object detection, named entity recognition, sentiment analysis, speech recognition, text classification →
TOLOKA AIsponsor

PEP 679: Allow Parentheses in assert Statements
“It is a common user mistake when using the form of the assert statement that includes the error message to surround it with parentheses. Unfortunately, this mistake passes undetected as the assert will always pass, because it is interpreted as an assert statement where the expression is a two-tuple, which always has truth-y value.”
PYTHON.ORG

Strict Python Function Parameters
Learn about keyword-only and positional-only parameters and see how using strict function signatures can help you write more resilient code.
SETH MICHAEL LARSON

Guiding Design Principles for Scientific Python
Tips on how to design and organize scientific Python code.
NSLS-II.GITHUB.IO


Python Jobs


Senior Full-Stack Web Developer
MONETIZEMORE 📍 ANYWHERE

Python Engineer (Web Scraping)
NEWSCATCHER 📍 ASIA, TX, AMERICA

PyCoder's Weekly Curator and Podcast Co-Host
REAL PYTHON 📍 ANYWHERE

Senior Software Engineer
BREW 📍 ANYWHERE

More Python Jobs >>>


Articles & Tutorials


Designing for Users and Building a Social Network With Django
Are you looking for a project to practice your Django skills? Designing the fundamental interactions of a social network is an instructive way to explore models and relationships while learning advanced Django skills. This week on the show, previous guest Martin Breuss talks about his new four-part tutorial series, “Build a Social Network With Django.”
REAL PYTHON podcast

Solving Wordle With Python
“Wordle seems to be trending and it got me thinking of what would be the best algorithm to solve it. I decided to do a naive implementation in Deepnote with Python that only uses NLTK’s list of all english words and base letter frequencies in english texts. This way, I was able to solve the January 18 challenge, but I used up all available attempts.”
SIMON SOTAK

Scrape Your Web Data From Any Target
With Oxylabs Scraper APIs, extract public data from the most complex targets. Our Scraper APIs handle JavaScript-heavy websites and support large data requests using over 102 million global proxy infrastructure. Receive data in JSON or CSV format and pay per successful request only. Start free trial →
OXYLABSsponsor

Starting With Python IDLE
In this course, you’ll learn how to use the development environment included with your Python installation. Python IDLE is a small program that packs a big punch! You’ll learn how to use Python IDLE to interact with Python directly, work with Python files, and improve your development workflow.
REAL PYTHON course

Modulo String Formatting in Python
You can use the % modulo operator for string formatting in Python. It’s a commonly used technique in older Python versions, especially in Python 2. Therefore, you might see it when digging into existing code bases, and it can be helpful to understand how it works.
REAL PYTHON

Understand Django: Go Fast With Django
How do you make your Django app fast? You measure what is slow, scale your system when necessary, and use a combination of fast database queries and strategic caching. This artcile explores those topics and more to help you get a performant Django app.
MATT LAYMAN • Shared by Matt Layman

Static Typing for Python Decorators
Accurately static typing decorators in Python is tricky. The wrapper function obfuscates type information required to statically determine the types of the wrapped function parameters. Here’s how you can circumnavigate that.
REDOWAN DELOWAR • Shared by Redowan Delowar

Python Type Hints: How to Type a Descriptor
“The descriptor protocol allow us to completely customize attribute access. Python’s documentation describes the protocol with types involved described with words. Let’s look at how we can write those as type hints.”
ADAM JOHNSON

The Power of Python Descriptors
An introduction to the Python descriptor protocol, with some example use cases. The descriptor protocol allows you to implement custom logic when a variable is accessed, or assigned a new value.
PICCOLO-ORM.COM

The Developer / Product Team Notification Template Problem
Notifications are hard. They require infrastructure that is reliable, scalable and observable as well as an end user experience that is helpful and respectful. That’s why we built Courier.
COURIERsponsor

Dealing With YAML With Arbitrary Tags in Python
Using the PyYAML library to safely read and write YAML with any tags, in a way that’s as straightforward as interacting with built-in types.
ANDGRAVITY.COM

An Introduction to Mypy’s @overload
“Sometimes the type of the returned value in a function depend on the type of the arguments in ways that can’t be captured with a Union.”
PATRICK NSUKAMI • Shared by Patrick Nsukami

How Vectorization Speeds Up Your Python Code
Vectorization allows you to speed up processing of homogeneous data in Python. Learn what it means, when it applies, and how to do it.
ITAMAR TURNER-TRAURING

A Trick to Have Arbitrary Infix Operators In Python
Discussing an interesting trick which adds support for infix operators in Python, e.g. 5 |add| 6
TOMER FILIBA

DIY Self Driving: A Holiday Side Project With Python
TRISTAN RICE


Projects & Code


Brought to you by Real Python for Teamssponsor
Online Python training created by a community of experts. Give your team the real-world Python skills they need to succeed →

pyccolo: Declarative Instrumentation for Python
GITHUB.COM/SMACKE

Qtile: Hackable Tiling Window Manager Written in Python
QTILE.ORG

sonora: A gRPC-Web Implementation for Python
GITHUB.COM/PUBLIC

EasyRPC: Sharing Python Functions Between Processes and Applications
GITHUB.COM/CODEMATION • Shared by Joshua Jamison

📆🐍 Upcoming Python Events


Weekly Real Python Office Hours Q&A (Virtual)
January 25, 2022

PyCamp Leipzig 2022
January 29 to January 31, 2022

PyDelhi User Group Meetup
January 29, 2022

PythOnRio Meetup
January 29, 2022

Introduction to the Python Programming Language (In Persian)
February 1, 2022

PyCon Iran Conference (Virtual)
February 1 to February 2, 2022

DjangoCon Europe 2022
September 21 to 25, 2022 in Porto, Portugal
Happy Pythoning!
Copyright © 2022 PyCoder’s Weekly, All rights reserved.