Where should you use an ellipsis in Python? How does it behave as a placeholder in a script, project, or stub file? What are the next goals for the Faster CPython project? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects.
We talk about a Real Python article that covers when you should use an ellipsis in Python. We discuss the similarities with the pass
keyword and how it’s used for type hints within stub files.
Christopher shares resources covering the goals of the Faster CPython project. We’re on the cusp of the release of Python 3.11, but the project keeps moving forward as they look at ways to continue speeding up Python.
We share several other articles and projects from the Python community, including a news roundup, alternatives for hosting Python-based applications, ways to create custom Python strings, a discussion about aging programmers, a structural diff that understands syntax, and a project for refurbishing and modernizing Python codebases.
Course Spotlight: Providing Multiple Constructors in Your Python Classes
In this video course, you’ll learn how to provide multiple constructors in your Python classes. To this end, you’ll learn different techniques, such as checking argument types, using default argument values, writing class methods, and implementing single-dispatch methods.
Topics:
- 00:00:00 – Introduction
- 00:02:26 – Django security releases issued
- 00:02:44 – PEP 698: Override Decorator for Static Typing
- 00:03:37 – Heroku Alternatives for Python-Based Applications
- 00:14:34 – Python 3.12 Goals: Faster-CPython Ideas Wiki
- 00:20:29 – Sponsor: InfluxDB
- 00:21:19 – When Do You Use an Ellipsis in Python?
- 00:28:18 – Custom Python Strings: Inheriting From
str
vsUserString
- 00:32:52 – Aging Programmer
- 00:46:32 – Video Course Spotlight
- 00:47:48 – difftastic: A Structural Diff That Understands Syntax
- 00:50:44 – refurb: Refurbish and Modernize Python Codebases
- 00:55:44 – Thanks and goodbye
News:
- Django security releases issued: 4.1.2, 4.0.8, and 3.2.16 | Weblog | Django
- PEP 698: Override Decorator for Static Typing – This Python Enhancement Proposal describes the use of a new decorator,
@override
, which would be used as a type hint for methods in a subclass that override a parent’s method. This type hint would introduce a level of safety if the parent method is refactored without corresponding changes to the child method.
Show Links:
- Heroku Alternatives for Python-Based Applications – Learn about alternatives to Heroku and their pros and cons. Platforms discussed include Digital Ocean, Google App Engine, AWS, Azure, PythonAnywhere, and half a dozen more.
- Python 3.12 Goals: Faster-CPython Ideas Wiki – A summary of the goals for the Faster CPython initiative within the Python 3.12 release. Includes trace optimizations, shrinking object sizes, improving memory management overhead, and more. See also the associated Workflow for 3.12 cycle checklist.
- When Do You Use an Ellipsis in Python? – You may have seen three dots in Python scripts. Although this syntax may look odd, using an ellipsis is valid Python code. In this tutorial, you’ll learn when Python’s
Ellipsis
constant can come in handy for you. - Custom Python Strings: Inheriting From
str
vsUserString
– In this tutorial, you’ll learn how to create custom string-like classes in Python by inheriting from the built-instr
class or by subclassingUserString
from thecollections
module.
Discussion:
Projects:
- difftastic: A Structural Diff That Understands Syntax
- refurb: Refurbish and Modernize Python Codebases
Additional Links:
- Opalstack
- cookiecutter-python · PyPI
- typeshed/stubs at master · python/typeshed
- Why Can’t Programmers.. Program?
Level up your Python skills with our expert-led courses: