Episode 141: Exploring Python With bpython & Formalizing f-String Grammar
The Real Python Podcast
Jan 20, 2023 56m
Have you used the Python Read-Eval-Print Loop (REPL) to explore the language and learn about how it operates? Would it help if it provided syntax highlighting, definitions, and code completion and behaved more like an IDE? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects.
Episode Sponsor:
We discuss the drop-in REPL replacement bpython. bpython enhances the interactivity of a Python REPL session. It’s also a powerful teaching tool for instructors and students to experiment with and explore Python code.
Christopher shares a recent Python Enhancement Proposal (PEP) about formalizing the grammar for f-strings. The PEP describes a reduction in the underlying parser code complexity and provides for future features like comments in multiline f-strings.
We share several other articles and projects from the Python community, including a news roundup, a collection of surveys to classify Python virtual environment workflows, a course about context managers and Python’s with
statement, a discussion about microfeatures that we would like to see adopted in Python, a Python terminal music player, and an infinite array powered by AI.
Course Spotlight: Context Managers and Python’s with
Statement
In this video course, you’ll learn what the Python with
statement is and how to use it with existing context managers. You’ll also learn how to create your own context managers.
Topics:
- 00:00:00 – Introduction
- 00:02:21 – Pillow 9.4.0 Released
- 00:02:47 – Django Bugfix Release: 4.1.5
- 00:02:56 – Plone 6.0 Released
- 00:03:16 – PyCon Italia 2023
- 00:03:54 – Discover bpython: A Python REPL With IDE-Like Features
- 00:13:55 – PEP 701: Syntactic Formalization of f-Strings
- 00:17:07 – Sponsor: Influx Data
- 00:17:57 – Classifying Python Virtual Environment Workflows
- 00:30:26 – Context Managers and Python’s
with
Statement - 00:36:32 – Video Course Spotlight
- 00:37:47 – Microfeatures I’d Like to See in More Languages
- 00:49:34 – Python Terminal Music Player
- 00:51:19 – Infinite AI Array
- 00:55:05 – Thanks and goodbye
News:
Show Links:
- Discover bpython: A Python REPL With IDE-Like Features – In this tutorial, you’ll learn about bpython, an alternative Python REPL that brings code suggestions and many other IDE-like features to the terminal. Once you discover how much bpython can improve your productivity, you’ll never want to return to using the vanilla Python REPL again.
- PEP 701: Syntactic Formalization of f-Strings – This Python Enhancement Proposal describes the formalization of a grammar for f-strings, allowing a reduction in the underlying parser code complexity and providing future features like comments in multiline f-strings.
- Classifying Python Virtual Environment Workflows – This article discusses the various ways of creating and managing Python virtual environments, including what kinds of tools you could use. It categorizes the different styles and describes how the choices that you make affect your workflow.
- Context Managers and Python’s
with
Statement – In this video course, you’ll learn what the Pythonwith
statement is and how to use it with existing context managers. You’ll also learn how to create your own context managers. - Microfeatures I’d Like to See in More Languages – Some language features are intrinsic to the language. Others are syntactic sugar that other programming languages could easily borrow. This opinion piece from Hillel highlights some features that the mainstream should steal from more obscure languages. Two Python features that he’d like to see in more languages are chained evaluations (
2 <= x < 10
) and numbers with separators (1000000 == 1_000_000).
Projects:
- Python Terminal Music Player
- Infinite AI Array – Learn about an insane library containing special lists and dicts so that any missed calls automatically go to GPT3 and add a predictive value in its place.
Additional Links: