Unraveling Python's Syntax to Its Core With Brett Cannon
Feb 12, 2021
auto_awesome
Python core developer Brett Cannon discusses unraveling Python's syntax to its core and his series of articles exploring the structure and workings of Python. He also talks about his role at Microsoft working on the Python extension for VS Code and recent Python enhancement proposals. The podcast covers topics such as syntactic sugar, Python in different environments, analyzing Python's syntax, and exploring perspectives and learning from different communities.
Understanding the core elements of Python's syntax is essential for comprehension and implementation.
Finding the right balance of syntactic sugar in Python is crucial for productivity and code readability.
Bringing Python to web browsers and other platforms through WebAssembly aims to increase its accessibility and impact.
Choosing the most effective implementation strategy, such as interpreter or compiler, is key for successfully integrating Python with WebAssembly.
Deep dives
Unraveling the Syntax of Python
Brett Cannon, a Python core developer, has been working on a series of articles where he dissects the syntax of Python. His goal is to determine the core elements of Python that are necessary for its functioning. The series acts as a resource for those looking to understand Python at its core and how it works. Brett also discusses his work as the dev manager for the Python extension for VS code at Microsoft. The podcast episode explores the potential of bringing Python to web browsers using WebAssembly. They discuss the need to define the minimum viable Python that should be implemented in WebAssembly and the possibility of a compliance test suite to ensure the correct implementation of Python semantics. The overarching goal is to make Python accessible in more platforms, such as mobile devices and web browsers.
The Importance of Syntactic Sugar
Syntactic sugar refers to additional syntax added to a language to simplify common patterns or make code more readable. Examples include decorators and assignment expressions. While syntactic sugar is important for increasing productivity and understanding, it is also crucial to strike a balance and not overuse it. The Real Python podcast episode delves into the significance of syntactic sugar in Python and highlights its potential benefits and drawbacks. The discussion emphasizes the need for syntactic sugar that simplifies code and reduces cognitive overhead.
Exploring the Potential of Python in WebAssembly
The podcast episode explores the potential of running Python in web browsers using WebAssembly. Brett Cannon discusses his interest in bringing Python to platforms like mobile devices and browsers to expand its accessibility and impact. He explains his plan to define the minimum viable Python that needs to be implemented and create a compliance test suite to ensure consistent Python semantics. The goal is to develop a version of Python that can be used on various platforms and that people can bring into their organizations, enabling more individuals to experience the benefits of the Python community.
Challenges and Considerations in Implementing Python in WebAssembly
Implementing Python in WebAssembly poses several challenges and considerations. One question is whether a REPL (Read-Eval-Print Loop) is necessary, as it can be complex to implement in a WebAssembly context. Another consideration is the trade-off between download size and execution performance. The size of the Python package to be downloaded should be minimized for efficiency, but sacrificing some memory usage for improved performance may be acceptable in a browser environment. The podcast episode highlights the need for planning and evaluating different implementation strategies, such as an interpreter or a compiler, to bring Python to WebAssembly effectively.
Exploring the Syntax of Python: A Blog Post Journey
Brett Cannon discusses his ongoing blog post series where he dives deep into the syntax and semantics of Python. He explains his motivation behind the series, which is to share his knowledge, help others understand the inner workings of the language, and showcase how Python can be implemented from scratch. The series starts with expressions, such as attribute access and binary arithmetic, and progresses to cover statements, literals, and more. Brett highlights the challenges he faces when translating Python's syntax and semantics into his blog posts and mentions his goal of completing the series this year.
Looking Forward to PyCascades Conference
Brett expresses his excitement for the PyCascades conference, an annual regional Python conference that rotates between Vancouver, Seattle, and Portland. He shares his positive experiences attending the conference in the past, emphasizing its beginner-friendly nature and offering affordable ticket prices. Brett mentions his participation in a panel discussion at the conference, focusing on open source and its impact during the pandemic. He highlights the value of regional conferences and the sense of community they foster.
Embracing Multiple Languages to Solve Problems
Brett discusses his passion for exploring and learning new programming languages. He believes that learning different languages helps developers expand their problem-solving perspectives and understand different paradigms. Brett mentions Rust as his go-to language for systems programming, and expresses his interest in learning Elixir. He praises Elixir's community, fault tolerance approach, and its foundation on top of Erlang, which powers highly reliable systems. Brett's desire to explore Elixir comes from its potential to enhance his programming toolbox and influence Python development.
Do you feel like you understand how Python works under the hood? What is syntactic sugar, and how much of it should be in Python? This week on the show, we have Brett Cannon. Brett is a Python core developer and he’s been working on a series of articles where he is unraveling the syntax of Python. His series is a fantastic resource for those wanting to learn how Python is structured and works at its core.
Brett wants to see a version of Python that can run in web browsers, so he started to breakdown Python into its syntactic elements to try to answer the question, what are core elements of Python? His detailed series takes the reader along for the ride.
Brett also works at Microsoft as the dev manager for the Python extension for VS Code. Brett is also serving his third term on the Python steering council, and we discuss recent Python enhancement proposals (PEP) that the council is considering.
In this course, you’ll explore some of the coolest and most useful features in the newly released Python 3.9. You’ll learn how Python 3.9 makes it easier to work with time zones, dictionaries, decorators, and several other techniques that will make your code cleaner and more efficient.
Topics:
00:00:00 – Introduction
00:01:43 – Working on the Python extension for VSCode
00:04:17 – Microsoft and the Python community
00:07:19 – How long have worked on core Python?
00:11:49 – Ways to contribute to core Python
00:14:19 – Upcoming features and PEPs
00:15:41 – Pattern matching PEPs
00:17:48 – Sponsor: Digital Ocean
00:18:29 – Being a member of the Python Steering Council
00:21:10 – Unravelling Python’s syntatic sugar series
00:24:39 – Magic methods, dunder methods, or special methods
00:27:07 – Are there ways that syntatic sugar can be overused?
00:33:31 – WebAssembly and Python being available in the browser
00:45:51 – Does Circuit Python or MicroPython show a path?
00:52:37 – Video Course Spotlight
00:53:41 – Taking Python syntax down to the implementation layer
01:03:21 – Taking apart Python’s syntax
01:16:07 – What other parts of Python syntax will you be unravelling?
01:24:04 – What are you excited about in the world of Python?