Python 3.8 Updates, Django Type Stubs, and Celery Use Cases

·23m 35s
Shared point

Enhancements in Python 3.8: Positional-Only Arguments

One of the most notable features arriving in Python 3.8 is the introduction of positional-only arguments. By utilizing a forward slash (/) in a function signature, developers can enforce that specific arguments must be provided by position, not by keyword. This mirrors behavior already existing at the C-level for built-in functions like pow().

Performance Benefits: Positional-only arguments can offer speed improvements and better compatibility with lower-level implementations like PyPy.
Consistency: It allows developers to mirror the behavior of built-in functions in their own API designs.

Advancements in the Python Ecosystem

Django Type Stubs

Type annotations are increasingly valuable for managing complexity in large web projects. A new library, Django-stubs, is helping bring comprehensive type-checking to Django, specifically addressing the "magic" that often makes static analysis difficult in the framework.

Learning Python with Code Combat

Code Combat offers an engaging, gamified approach to programming that utilizes real Python syntax rather than simplified "drag-and-drop" interfaces. It is particularly effective for teaching children and beginners by using visual dungeons and puzzles to anchor programming concepts.

"It really introduces you to what professional programming is. It doesn't sugarcoat it too much for you."

Building Robust Python Applications

Strategic Use of Celery

Celery remains the standard for asynchronous task queues in Python. The discussion highlights four primary use cases:
• Sending emails
• Connecting to third-party APIs
• Running long-running background processes
• Managing scheduled tasks

Workflow Testing with PyTest Steps

For complex functional tests that require multiple stages, pytest-steps allows developers to break down a long test into smaller, manageable chunks. This improves reporting and helps identify exactly where a multi-step workflow fails.

Doc Assemble for Workflow Surveys

Doc Assemble is a powerful, open-source tool for conducting self-guided interviews or surveys. It allows developers to define complex logic flows using YAML and Python, making it ideal for legal or data-gathering processes that require significant conditional control.

Topics

Chapters

6 chapters
Python Bytes
AI chat — answers grounded in episodes