Python Typeclasses, Custom DRF Permissions Classes, How to Count in Python, and More

#480 – JULY 6, 2021 VIEW IN BROWSER
The PyCoder’s Weekly Logo
Typeclasses in Python
Sometimes you need to change the behavior of a function based on the type of argument passed to it. This is a classic example of polymorphism in programming. In this article, you’ll learn how this is typically done in Python, compare that to polymorphism in other languages, and see how the new classes library can make the whole process easier.
NIKITA SOBOLEV • Shared by Nikita Sobolev

Custom Permission Classes in Django REST Framework
One of the great things about Django REST Framework (DRF) is how easy it is to be productive with the built-in API views and permission classes. But sometimes you need a bit more control than the built-in objects allow. This article walks you through how to create and use custom permission classes in DRF so that you can have complete control over how permissions work in your REST API.
TESTDRIVEN.IO • Shared by Špela Giacomelli (aka GirlLovesToCode)

Monitor Your Python Applications’ Performance in Real Time with Datadog APM
Pinpoint hard-to-reproduce problems in your production code without affecting your app’s performance with Datadog’s Continuous Profiler. Locate which functions (or lines of code) consume the most resources, such as CPU and memory and optimize for a better app experience. Try Datadog APM free →
DATADOGsponsor

Python’s Counter: The Pythonic Way to Count Objects
In this step-by-step tutorial, you’ll learn how to use Python’s Counter to count several repeated objects at once. You’ll also learn how to use Counter objects to enhance other computations that you do in Python.
REAL PYTHON

TLDR Newsletter: Byte Sized News for Techies
TLDR is a daily, curated newsletter with links and TLDRs of the most interesting stories in tech, science, and programming.
TLDR.TECH sponsor

Django Security Releases Issued: 3.2.5 and 3.1.13
DJANGO SOFTWARE FOUNDATION


Discussions


Why is a, b = b, a not always equivalent to b, a = a, b?
In Python you can swap the values of two variables without creating a temporary variable. So, if you have two variables a = 1 and b = 2, you can swap their values using a, b = b, a. Now a has the value 2 and b has the value 1. So shouldn’t b, a = a, b do the same thing? In most cases, it will, but one user on Stack Overflow found an instance where they don’t, and the explanation gets into the nitty-gritty about how assignments are evaluated.
STACK OVERFLOW


Python Jobs


Software Engineer (Remote)
CLOSE

Backend Software Engineer (Remote)
TESSIAN

Python Web Developer (Los Angeles, CA, USA)
PREMIERE DIGITAL SERVICES

Senior Software Engineer (New York, NY, USA)
TRUVERIS

More Python Jobs >>>


Articles & Tutorials


Coherent Python and PostgreSQL Enums Using SQLAlchemy
An Enumlets you restrict variables to a set of constants. You can use them to map values that would typically be strings to integer constants, which helps reduce human error due to misspellings. SQLAlchemy also supports enums for use with your database layer. This article shows you how to generate an SQLAlchemy enum from a Python Enum instance so that your data can live in a single place and be shared between the Python and database layers of your application.
BRENDAN LE

Parameterizing and Automating Jupyter Notebooks With Papermill
Jupyter Notebooks are a great way to create reproducible experiments and data analysis, but sometimes you want to alter parameters used in the notebook to see how the results change. One way to do that is with the papermill package. Using papermill, you can execute a notebook with new parameters straight from the command line.
MATT WRIGHT

The Ultimate Guide to Cardinality for Observability
Cardinality is an unavoidable consequence of scale that can’t be solved by simply throwing more resources at it. This guide will help you understand what it is, why it impacts observability, as well as how to work with, and around the limitations of high-cardinality performance data →
LIGHTSTEPsponsor

Securing Your Python Software Supply Chain With Dustin Ingram
How well do you know your software supply chain? When you PIP install a package, what steps can you take to minimize the risk of installing something malicious? This week on the Real Python Podcast, we have Dustin Ingram, a director of the Python Software Foundation (PSF) and a maintainer of the Python Package Index (PyPI).
REAL PYTHON podcast

How to Handle JWTs in Python
JavaScript Web Tokens (JWTs) are used to store information about web users. They are compact and can be used to authorize users in APIs. In this article and how to create and verify them in Python using the PyJWT package.
JESSICA TEMPORAL • Shared by Robertino

Get Feedback Faster with YourBase Test Acceleration
YourBase Test Acceleration can reduce testing and compute cost time by up to 90%. You don’t have to replace your CI, your build system, or your version control. Getting started is as easy as a pip install, and you don’t have to share any data.
YOURBASEsponsor

Defining and Calling Python Functions
In this course, you’ll learn how to define and call your own Python function. You’ll also learn about passing data to your function and returning data from your function back to its calling environment.
REAL PYTHON course


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 →

calibre: Official Source Code Repository for the Calibre Ebook Manager
GITHUB.COM/KOVIDGOYAL

luigi: Python Module That Helps You Build Complex Pipelines of Batch Jobs
GITHUB.COM/SPOTIFY

interactive-coding-challenges: 120+ Interactive Python Coding Interview Challenges With Anki Flashcards
GITHUB.COM/DONNEMARTIN

saleor: A Modular, High Performance, Headless E-Commerce Platform
GITHUB.COM/MIRUMEE

plotext: Plotting in the Terminal
GITHUB.COM/PICCOLOMO

pyjwt: JSON Web Token Implementation in Python
GITHUB.COM/JPADILLA

📆🐍 Upcoming Python Events


⋅ Real Python Office Hours (Virtual) July 6, 2021

⋅ PyBirras 2021 (Virtual) July 8, 2021

⋅ SciPy 2021 (Virtual) July 12 to July 19, 2021

⋅ EuroPython 2021 (Virtual) July 26 – August 1, 2021

⋅ PyCon India 2021 (Virtual) September 17 – 20, 2021
Happy Pythoning!
Copyright © 2021 PyCoder’s Weekly, All rights reserved.
You are receiving this email because you opted in on our website at pycoders.com
Our mailing address: DevCademy Media Inc. · #720-999 West Broadway, Vancouver BC V5Z 1K5, Canada

Unsubscribe | Update Email Address

Older messages

Subclassing in Python, Correlation Analysis 101, Reversion Python Lists and Beyond, And More

Tuesday, June 29, 2021

Subclassing in Python Redux #479 – JUNE 29, 2021 VIEW IN BROWSER The PyCoder's Weekly Logo Subclassing in Python Redux Have you ever heard someone say that composition is better than inheritance?

Pivot and Plot Data With Pandas, The Future of FastAPI and Pydantic, Complex Numbers in Python, And More

Tuesday, June 22, 2021

How to Pivot and Plot Data With Pandas #478 – JUNE 22, 2021 VIEW IN BROWSER The PyCoder's Weekly Logo How to Pivot and Plot Data With Pandas One of the challenges of working with data is knowing

Python vs. Excel, Python CSV Practice Problems, Analyzing LEGO Prices, and More

Tuesday, June 15, 2021

Excel, Python, and the Future of Data Science #477 – JUNE 15, 2021 VIEW IN BROWSER The PyCoder's Weekly Logo Excel, Python, and the Future of Data Science What's the most widely used tool in

70+ Python Projects, PEP 654 and Exception Groups, Context Managers, and More

Tuesday, June 8, 2021

PEP 654: Exception Groups and `except*` #476 – JUNE 8, 2021 VIEW IN BROWSER The PyCoder's Weekly Logo PEP 654: Exception Groups and except* Currently, Python's exception handling mechanisms

Detecting Deforestation From Satellite Images, Python Virtual Environment With conda, Matplotlib Scatter Plots, and More

Tuesday, June 1, 2021

Detecting Deforestation From Satellite Images #475 – JUNE 1, 2021 VIEW IN BROWSER The PyCoder's Weekly Logo Detecting Deforestation From Satellite Images How would you go about detecting

You Might Also Like

Ranked | The Most Satisfying vs. Most Reliable Car Brands in 2024 🚙

Monday, December 23, 2024

The most reliable car brands are rarely the most satisfying to own, according to recent Consumer Reports survey data. View Online | Subscribe | Download Our App Presented by: Find the megatrends

Bitcoin Enthusiasts Are Letting Altcoins Pass by

Monday, December 23, 2024

Top Tech Content sent at Noon! Boost Your Article on HackerNoon for $159.99! Read this email in your browser How are you, @newsletterest1? 🪐 What's happening in tech today, December 23, 2024? The

Last Minute Gifts from Walmart

Monday, December 23, 2024

ZDNET ZDNET Sponsored Message In Partnership with Walmart December 23, 2024 exclusive offer Walmart Last-minute gifts from Walmart Shop Now Walmart The tech you've been wishing for–at everyday low

15 ways AI saved me weeks of work in 2024

Monday, December 23, 2024

ZDNET's product of the year; Windows 11 24H2 bug list updated -- ZDNET ZDNET Tech Today - US December 23, 2024 AI applications on various devices. 15 surprising ways I used AI to save me weeks of

Distributed Locking: A Practical Guide

Monday, December 23, 2024

If you're wondering how and when distributed locking can be useful, here's the practical guide. I explained why distributed locking is needed in real-world scenarios. Explored how popular tools

⚡ THN Weekly Recap: Top Cybersecurity Threats, Tools and Tips

Monday, December 23, 2024

Your one-stop-source for last week's top cybersecurity headlines. The Hacker News THN Weekly Recap The online world never takes a break, and this week shows why. From ransomware creators being

⚙️ OpenA(G)I?

Monday, December 23, 2024

Plus: The Genesis Project ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Post from Syncfusion Blogs on 12/23/2024

Monday, December 23, 2024

New blogs from Syncfusion Introducing the New WinUI Kanban Board By Karthick Mani This blog explains the features of the new Syncfusion WinUI Kanban Board control introduced in the 2024 Volume 4

Import AI 395: AI and energy demand; distributed training via DeMo; and Phi-4

Monday, December 23, 2024

What might fighting for freedom in an AI age look like? ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

LockBit Ransomware Developer Charged for Billions in Global Damages

Monday, December 23, 2024

THN Daily Updates Newsletter cover The Data Science Handbook, 2nd Edition ($60.00 Value) FREE for a Limited Time Practical, accessible guide to becoming a data scientist, updated to include the latest