The Real Python Podcast

Real Python
undefined
Nov 4, 2022 • 1h 2min

Exploring the New Features of Python 3.11

Python 3.11 is here! Our regular guests, Geir Arne Hjelle and Christopher Trudeau, return to talk about the new version. Geir Arne wrote a series of preview tutorials earlier this year, and his annual piece, titled “Python 3.11: Cool New Features for You to Try,” was published on October 24. Christopher’s video course came out the next day, covering the topics from the tutorial with visual examples of Python 3.11 in action. Geir Arne and Christopher collaborated to create code examples for the new features. We discuss better error messages, faster code execution, task and exception groups, typing features, and native TOML support. We dive into the updates and offer advice about ways to incorporate them into your projects. We also consider when you should start running Python 3.11. Course Spotlight: Cool New Features in Python 3.11 – Real Python In this video course, you’ll explore what Python 3.11 brings to the table. You’ll learn how Python 3.11 is the fastest and most user-friendly version of CPython yet, and learn about improvements to the typing system and to the asynchronous features of Python. Topics: 00:00:00 – Introduction 00:02:19 – Preview series 00:03:50 – Faster CPython project 00:07:10 – Specializing adaptive interpreter 00:11:24 – Other performance stuff 00:16:07 – Sponsor: Deepgram 00:16:51 – Improved tracebacks 00:21:49 – Exception groups and notes 00:27:22 – Self type and additional type hints 00:36:14 – Video Course Spotlight 00:37:27 – asyncio and task groups 00:41:25 – TOML and tomllib 00:46:21 – ISO date parsing 00:50:09 – Negative zeros 00:53:38 – Dead battery deprecations 00:56:04 – Advice on upgrading 01:01:01 – Thanks and goodbye Show Links: Python 3.11: Cool New Features for You to Try – Real Python Cool New Features in Python 3.11 – Video Course faster-cpython/plan.md - GitHub PEP 659 – Specializing Adaptive Interpreter - peps.python.org Just-in-time compilation - Wikipedia Episode #381 Python Perf: Specializing, Adaptive Interpreter - Talk Python To Me Podcast Episode #339 Making Python Faster with Guido and Mark - Talk Python To Me Podcast “Zero cost” exception handling · Issue #84403 · python/cpython - GitHub Python 3.11 Preview: Task and Exception Groups – Real Python Faster Startup In Python 3.11 — Python 3.11.0 documentation Python 3.11 Preview: Even Better Error Messages – Real Python PEP 657 – Include Fine Grained Error Locations in Tracebacks - peps.python.org Episode #105: Creating Better Error Messages for Python 3.10 & 3.11 – The Real Python Podcast Exception Groups and except: Irit Katriel - YouTube PEP 673 – Self Type - peps.python.org PEP 646 – Variadic Generics - peps.python.org How Exception Groups Will Improve Error Handling in AsyncIO - Łukasz Langa | Power IT Conference - YouTube Neopythonic: Reasoning about asyncio.Semaphore PEP 680 – tomllib: Support for Parsing TOML in the Standard Library - peps.python.org TOML: Tom’s Obvious Minimal Language Python 3.11 Preview: TOML and tomllib – Real Python datetime — Basic date and time types — Python 3.11.0 documentation 13 Month Calendar Signed zero - Wikipedia PEP 594 – Removing dead batteries from the standard library - peps.python.org Level up your Python skills with our expert-led courses: Cool New Features in Python 3.10 Cool New Features in Python 3.11 Python Type Checking Support the podcast & join our community of Pythonistas
undefined
Oct 21, 2022 • 1h 9min

Fostering an Internal Python Community & Managing the 3.11 Release

Does your company have a plan for growing an internal Python community? What are the attributes to look for when bringing someone into your department? This week on the show, Pablo Galindo Salgado returns to talk about building community through the Python Guild at Bloomberg and managing the release of Python 3.11. Pablo describes how the Python Guild started and currently operates inside Bloomberg. We talk about how it fosters community and acts as a way to promote internally developed tools across disparate teams. We also discuss how work groups use it to find new internal candidates for their teams. Pablo talks about his role as release manager for Python 3.10 and 3.11. He shares the intense journey the team has had this year in preparing for the release of 3.11. He details updating testing strategies to work with the new specializing adaptive interpreter. Course Spotlight: Python Basics: Strings and String Methods In Python, collections of text are called strings. In this course, you’ll learn about this fundamental data type and the string methods that you can use to manipulate strings. Along the way, you’ll learn ways to work with strings of numbers, and how to format strings for printing. Topics: 00:00:00 – Introduction 00:02:13 – Python Guild inside of Bloomberg 00:13:31 – Finding candidates for the guild from other areas 00:19:11 – Sponsor: Platform.sh 00:19:47 – Considering eagerness to learn and excitement 00:29:44 – Structuring the guild into work groups 00:33:43 – How are things going as release manager? 00:38:25 – Testing for adaptive interpreters 00:44:02 – Working toward the feature freeze 00:50:39 – Changing the parser went smoothly 00:54:34 – Video Course Spotlight 00:55:55 – Where do you find the time? 00:59:51 – How’s the sweep picking coming along? 01:00:33 – What are you excited about in the world of Python? 01:01:29 – What do you want to learn next? 01:07:18 – How can people follow the work you do? 01:08:20 – Thanks and goodbye Show Links: Bloomberg publishes Memray, a new open source memory profiler for Python code - Bloomberg LP bloomberg/memray: Memray is a memory profiler for Python Pluralsight Tech Blog - Guilds at Pluralsight Lessons From Building a Community of Python Users Among Capital One’s Analysts - Capital One PEP 13 – Python Language Governance - peps.python.org Python Insider: Python 3.11.0rc2 is now available What’s New In Python 3.11 — Python 3.11.0rc2 documentation PEP 659 – Specializing Adaptive Interpreter - peps.python.org Andon (manufacturing) - Wikipedia Learn Rust - Rust Programming Language Swift - Apple raywenderlich.com - High quality programming tutorials: iOS, Android, Swift, Kotlin, Flutter, Server Side Swift, Unity, and more! Python Developers Survey 2022 pablogsal (Pablo Galindo Salgado) - GitHub Pablo Galindo Salgado (@pyblogsal) - Twitter Level up your Python skills with our expert-led courses: Python Basics: Strings and String Methods Cool New Features in Python 3.10 Python Basics: Code Your First Python Program Support the podcast & join our community of Pythonistas
undefined
Oct 14, 2022 • 57min

Using an Ellipsis in Python & Goals for CPython 3.12

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 vs UserString 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 vs UserString – In this tutorial, you’ll learn how to create custom string-like classes in Python by inheriting from the built-in str class or by subclassing UserString from the collections module. Discussion: Aging Programmer 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: Sneaky REST APIs With Django Ninja Using Multiple Constructors in Your Python Classes Using Python Class Constructors Support the podcast & join our community of Pythonistas
undefined
Oct 7, 2022 • 1h 4min

Using a Memory Profiler in Python & What It Can Teach You

Have you used a memory profiler to gauge the performance of your Python application? Maybe you’re using it to troubleshoot memory issues when loading a large data science project. What could running a profiler show you about a codebase you’re learning? This week on the show, Pablo Galindo Salgado returns to talk about Memray, a powerful tracing memory profiler. Pablo developed Memray while working at Bloomberg to track memory allocations beyond Python code into native extensions and the interpreter itself. It’s a compelling tool that provides fine-grain reports to help you understand where memory is used. Pablo shares the reporting that Memray provides, including live mode, flame graphs, and a pytest plug-in. We also discuss how a tracing memory profiler can help you understand a new codebase. He walks through how he developed the first prototype internally and eventually moved the project into open source. This is the first part of my conversation with Pablo. In a couple of weeks, you’ll get the second part, where we talk about Python guilds inside large companies and his work as the release manager for Python 3.10 and 3.11. Course Spotlight: SQLite and SQLAlchemy in Python: Moving Your Data Beyond Flat Files In this video course, you’ll learn how to store and retrieve data using Python, SQLite, and SQLAlchemy as well as with flat files. Using SQLite with Python brings with it the additional benefit of accessing data with SQL. By adding SQLAlchemy, you can work with data in terms of objects and methods. Topics: 00:00:00 – Introduction 00:02:48 – When should you use a memory profiler? 00:05:13 – Fine-grain reporting 00:13:17 – Sampling profiler vs tracing profiler 00:19:46 – Sponsor: Deepgram 00:20:31 – What is a flame graph? 00:30:36 – Using Rich for terminal reporters 00:40:08 – Currently only Linux and macOS 00:41:13 – pytest plug-in 00:42:03 – Showing native allocation details 00:44:20 – Video Course Spotlight 00:45:52 – Using a profiler to learn a codebase 00:54:39 – Moving from internal project to open source 01:02:17 – Thanks and goodbye Show Links: memray: Memray is a memory profiler for Python - GitHub bloomberg/memray memray - PyPI Bloomberg publishes Memray, a new open source memory profiler for Python code - Bloomberg LP What is a Flame Graph? How it Works & Use Cases - Datadog Gantt chart - Wikipedia py-spy - PyPI scalene - PyPI Reduce your Python program’s memory usage with Fil fil: A Python memory profiler for data processing and scientific computing applications - GitHub pythonspeed/filprofiler Episode #24: Options for Packaging Your Python Application: Wheels, Docker, and More - The Real Python Podcast rich - PyPI Textualize Brendan Gregg Linux perf Examples Deepgram - Speech-to-Text for Developers & Enterprise Level up your Python skills with our expert-led courses: Debugging in Python With pdb SQLite and SQLAlchemy in Python: Moving Your Data Beyond Flat Files Testing Your Code With pytest Support the podcast & join our community of Pythonistas
undefined
Sep 30, 2022 • 59min

Explaining Access Control Using Python & Cautiously Handling Pickles

Have you ever used code to help explain a topic? How can Python scripts be used to understand the intricacies of access control? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects. Christopher talks about an article that explores the evolution of access control by reimplementing the concepts with Python scripts. The experiment moves across the various access forms, starting with control lists, roles, and attributes, then ending with purpose-based access control (PBAC). We also cover a post about how to create dangerous pickles. We discuss where malicious code can hide within the serialization process and how decompiling code can be an education tool. We share several other articles and projects from the Python community, including command line interface (CLI) creation with argparse, HTML and CSS for Python developers, a Python packaging user survey, a visual Python Tkinter GUI creator, a PyScript-based data visualization cookbook, and a project for writing functional test helpers in Django. Course Spotlight: Serializing Objects With the Python pickle Module In this course, you’ll learn how you can use the Python pickle module to convert your objects into a stream of bytes that can be saved to a disk or sent over a network. You’ll also learn the security implications of using this process on objects from an untrusted source. Topics: 00:00:00 – Introduction 00:02:19 – Python 3.11.0rc2 is now available 00:03:45 – HTML and CSS for Python Developers 00:08:34 – Evolution of Access Control Explained Through Python 00:17:14 – Sponsor: InfluxDB 00:18:03 – Dangerous Pickles 00:28:08 – Building Command Line Interfaces With argparse 00:34:27 – Video Course Spotlight 00:35:45 – PyPI.org is running a survey 00:49:01 – Visual Python Tkinter GUI Creator 00:50:33 – Python Data Visualization Cookbook 00:52:06 – django-functest: Helpers for Functional Tests in Django 00:57:55 – Thanks and goodbye Show Links: Python Insider: Python 3.11.0rc2 is now available HTML and CSS for Python Developers – There’s no way around HTML and CSS when you want to build web apps. Even if you’re not aiming to become a web developer, knowing the basics of HTML and CSS will help you understand the Web better. In this tutorial, you’ll get an introduction to HTML and CSS for Python programmers. Evolution of Access Control Explained Through Python – Sometimes, writing code can help you explore and understand concepts. This article shows a history of access controls in software, using Python scripts to reimplement the ideas. Dangerous Pickles – A light introduction to the Python pickle protocol, the Pickle Machine, and the construction of malicious pickles. Learn why your code shouldn’t trust arbitrary serialized objects, and discover the dangers of pickle-bombs. Building Command Line Interfaces With argparse – In this step-by-step Python video course, you’ll learn how to take your command line Python scripts to the next level by adding a convenient command line interface that you can write with argparse. Discussion: Python Packaging User Survey PyPI.org is running a survey on the state of Python packaging | Hacker News Projects: Visual Python Tkinter GUI Creator - Chinese Python Data Visualization Cookbook django-functest: Helpers for Functional Tests in Django Additional Links: Axess Lab | Alt-texts: The Ultimate Guide The Python pickle Module: How to Persist Objects in Python – Real Python Understanding pickle in Python | #hsfzxjy# The ultimate guide to Python pickle | Snyk Pickle’s nine flaws | Ned Batchelder pickle — Python object serialization — Python 3.10.7 documentation pickletools — Tools for pickle developers — Python 3.10.7 documentation argparse — Parser for command-line option | Python 3.10.7 documentation Have been testing @pyscript_dev these past few days and finally made something cool. I built an interactive data viz cookbook | Dylan Castillo - Twitter Level up your Python skills with our expert-led courses: Grow Your Python Portfolio With 13 Intermediate Project Ideas Building Command Line Interfaces With argparse Serializing Objects With the Python pickle Module Support the podcast & join our community of Pythonistas
undefined
8 snips
Sep 23, 2022 • 1h 10min

Python as an Efficiency Tool for Non-Developers

Are you interested in using Python in an industry outside of software development? Would adding a few custom software tools increase efficiency and make your coworkers’ jobs easier? This week on the show, Josh Burnett talks about using Python as a mechanical engineer. I met Josh at PyCon US 2022 in Salt Lake City, which he attended for the first time with several coworkers. He suggested we do an episode to shed some light on ways that Python is being used professionally by people who aren’t primarily programming for a living. Josh works as a mechanical engineer for an equipment manufacturer, where he needs to perform repetitive tasks and generate copious logs. He explains how he moved his team away from MATLAB and toward Python. We discuss his progression from writing scripts to developing packages and eventually hosting his work on PyPI. He also shares his explorations with CircuitPython for personal and professional projects. Course Spotlight: Building Python Project Documentation With MkDocs In this video course, you’ll learn how to build professional documentation for a Python package using MkDocs and mkdocstrings. These tools allow you to generate nice-looking and modern documentation from Markdown files and, more importantly, from your code’s docstrings. Topics: 00:00:00 – Introduction 00:02:10 – Meeting at PyCon US 2022 00:04:32 – Bringing members of team to PyCon 00:05:30 – What are next generation instrumentation platforms? 00:06:35 – What is the lifespan of a platform? 00:09:26 – Has interconnectivity affected upgrades? 00:10:57 – Programming and Python background 00:12:13 – Introduction to MATLAB at university 00:15:18 – Moving away from MATLAB to Python 00:19:39 – How was your transition from Python 2 to 3? 00:21:19 – Debugging methods and logging 00:22:27 – Why did you choose Python? 00:24:26 – Sponsor: Deepgram 00:25:12 – Promoting more use of Python in the organization 00:33:07 – Selling the idea of Python training in the organization 00:37:16 – Moving from scripts to building packages 00:43:48 – From personal project to critical package on PyPI 00:44:29 – Using PyPI or in-house package repository 00:46:27 – Experience with modern packaging tools 00:48:16 – Video Course Spotlight 00:49:32 – Using CircuitPython for personal and work projects 00:56:09 – Use of 3D printing and machining 00:57:33 – Josh’s projects on PyPI 01:02:57 – What are you excited about in the world of Python? 01:05:23 – What do you want to learn next? 01:08:46 – How can people follow your work? 01:09:07 – Thanks and goodbye Show Links: PyPI Profile of joshburnett PyCon 2022 Welcome to PyCon US 2022 MATLAB - MathWorks - MATLAB & Simulink devpi: PyPI server and packaging/testing/release tool Artifactory - Universal Artifact Repository Manager - JFrog loguru · PyPI How to Publish an Open-Source Python Package to PyPI – Real Python Python and TOML: New Best Friends – Real Python PyQtGraph - Scientific Graphics and GUI Library for Python CircuitPython Adafruit MagTag - 2.9 Grayscale E-Ink WiFi Display canaveral · PyPI addcopyfighandler · PyPI PyScript | Run Python in your HTML What exactly is WASI? - Wasm Builders 🧱 WASI - WebAssembly System Interface KiCad EDA - Schematic Capture & PCB Design Software Lessons learned from building a custom CircuitPython board - Stargirl (Thea) Flowers Using Python to vectorize artwork for PCBs - Stargirl (Thea) Flowers Josh Burnett - GitHub Josh Burnett - LinkedIn Level up your Python skills with our expert-led courses: Building Python Project Documentation With MkDocs How to Publish Your Own Python Package to PyPI Python Modules and Packages: An Introduction Support the podcast & join our community of Pythonistas
undefined
Sep 16, 2022 • 53min

Improve Matplotlib With Style Sheets & Python Async for the Web

Have you thought the standard output from Matplotlib is a bit generic looking? Would you like a quick way to add style and consistency to your data visualizations? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects. We cover an article about the magic of creating style sheets for Matplotlib. You can quickly customize plots and graphs with a single line of code. We share additional resources for you to try out new styles and learn what parameters are customizable. Christopher covers an article about using async for web development in Python. The creation of Python generators inspired the development of async functionality. He discusses recent changes and async additions within Python web frameworks. We cover several other articles and projects from the Python community, including how to install a pre-release version of Python, cache in Python with lru_cache, and get better at debugging, along with suggestions of libraries that deserve attention, a Python library for creating mathematical animations, and an extremely fast Python linter that’s written in Rust. Course Spotlight: Python Debugging With pdb In this hands-on course, you’ll learn the basics of using pdb, Python’s interactive source code debugger. pdb is a great tool for tracking down hard-to-find bugs, and it allows you to fix faulty code more quickly. Topics: 00:00:00 – Introduction 00:02:21 – Python releases 3.10.7, 3.9.14, 3.8.14, and 3.7.14 are now available 00:03:51 – How Can You Install a Pre-Release Version of Python? 00:08:13 – Understanding async Python for the Web 00:17:11 – The Magic of Matplotlib Style Sheets 00:24:20 – Sponsor: Platform.sh 00:24:56 – Caching in Python With lru_cache 00:29:41 – Some Ways to Get Better at Debugging 00:38:14 – Video Course Spotlight 00:39:26 – Suggest a Lesser Known Library Deserving Attention 00:44:52 – ruff: An Extremely Fast Python Linter, Written in Rust 00:48:19 – Manim: Python Library for Creating Mathematical Animations 00:51:50 – Thanks and goodbye Show Links: Python releases 3.10.7, 3.9.14, 3.8.14, and 3.7.14 are now available How Can You Install a Pre-Release Version of Python? – If you want to have a peek at what’s coming in the next stable version of Python, then you can install a pre-release version. In this tutorial, you’ll learn how to access the latest Python versions and help test them. Understanding async Python for the Web – “Recently Django 4.1 was released, and the thing most people seem interested in is the expanded async support. The Python web ecosystem has been seeing new frameworks pop up which are fully async, or support going fully async, from the start.” Learn more about async and its use in web frameworks. The Magic of Matplotlib Stylesheets – With a single line of code, you can integrate a style sheet with your Matplotlib visualization. In this tutorial, you’ll learn how to make your very own custom reusable style sheet. Caching in Python With lru_cache – Caching is an essential optimization technique. In this video course, you’ll learn how to use Python’s @lru_cache decorator to cache the results of your functions using the LRU cache strategy. This is a powerful technique you can use to leverage the power of caching in your implementations. Some Ways to Get Better at Debugging – This is a short summary of a couple of academic papers on how to improve your debugging skills. The suggestions are to learn the codebase, learn the system, learn your tools, learn strategies, and gain experience. Discussions: Suggest a Lesser Known Library Deserving Attention Projects: ruff: An Extremely Fast Python Linter, Written in Rust Manim: Python Library for Creating Mathematical Animations Additional Links: Managing Multiple Python Versions With pyenv – Real Python Your Python Coding Environment on Windows: Setup Guide – Real Python Customizing Matplotlib with style sheets and rcParams — Matplotlib 3.5.3 documentation dhaitz/matplotlib-stylesheets: Stylesheets for Matplotlib Kaggle: Your Home for Data Science wizard zines Rubber Duck Debugging – Debugging software with a rubber ducky pudb · PyPI Humre · PyPI Welcome to Nox — Nox 2022.8.7 documentation Episode #21: Exploring K-means Clustering and Building a Gradebook With Pandas – The Real Python Podcast 3Blue1Brown - YouTube Level up your Python skills with our expert-led courses: Python Basics: Finding and Fixing Code Bugs Python Plotting With Matplotlib Debugging in Python With pdb Support the podcast & join our community of Pythonistas
undefined
Sep 9, 2022 • 1h 21min

Exploring Recursion in Python With Al Sweigart

Have you wanted to understand recursion and how to use it in Python? Are you familiar with the call stack and how it relates to tracebacks? This week on the show, Al Sweigart talks about his new book, “The Recursive Book of Recursion.” Recursion is one of those concepts held as a tenet of high-level computer science priesthood. Al explains the fundamentals of writing recursive functions and a critical missing piece in understanding how they operate, the call stack. After completing his research, he concluded that it’s a technique that you should understand but rarely use. He also shares the few cases where recursion is an appropriate solution. Along the way, we talk about directed acyclic graphs, solving mazes, exploring file trees, and creating fractal images. Course Spotlight: Caching in Python With lru_cache Caching is an essential optimization technique. In this video course, you’ll learn how to use Python’s @lru_cache decorator to cache the results of your functions using the LRU cache strategy. This is a powerful technique you can use to leverage the power of caching in your implementations. Topics: 00:00:00 – Introduction 00:01:55 – The Recursive Book of Recursion 00:02:55 – A Beginner’s Guide to Recursion - YouTube 00:05:41 – What is recursion? 00:10:17 – Understanding the call stack 00:12:15 – Languages moving from GOTO statements to functions and a stack 00:21:11 – A common recursion example of factorials 00:26:00 – Fibonacci sequence and memoization 00:30:25 – Cautionary advice on applying recursion 00:32:55 – What is recursion useful for? 00:39:56 – Video Course Spotlight 00:41:14 – Recursion and directed acyclic graphs 00:45:46 – Book examples 00:49:50 – Thoughts on tail recursion 00:54:34 – How has the scope of the book evolved? 01:00:34 – Creating examples in two languages 01:02:37 – Upcoming projects 01:05:19 – Examples of the projects in the book 01:10:30 – What are you excited about in the world of Python? 01:14:50 – What do you want to learn next? 01:19:06 – How can people follow your work? 01:19:48 – Thanks and goodbye Show Links: The Recursive Book of Recursion | No Starch Press Recursion for Beginners: A Beginner’s Guide to Recursion - YouTube The Invent with Python Blog Recursion in Python factorial | Definition, Symbol, & Facts | Britannica Fibonacci sequence | Definition, Formula, Numbers, Ratio, & Facts | Britannica A Python Guide to the Fibonacci Sequence – Real Python Directed acyclic graph - Wikipedia Dynamic programming - Wikipedia The Little Schemer : Friedman, Daniel P : Internet Archive Book Review: The Little Schemer - The Invent with Python Blog Droste effect - Wikipedia Episode #33: Going Beyond the Basic Stuff With Python and Al Sweigart – The Real Python Podcast Textualize Episode #80: Make Your Python App Interactive With a Text User Interface (TUI) – The Real Python Podcast BeeWare — Write once. Deploy everywhere. Episode #22: Create Cross-Platform Python GUI Apps With BeeWare – The Real Python Podcast Origami with Jo Nakashima - YouTube Invent with Python Level up your Python skills with our expert-led courses: Grow Your Python Portfolio With 13 Intermediate Project Ideas Caching in Python With lru_cache Exploring the Fibonacci Sequence With Python Support the podcast & join our community of Pythonistas
undefined
Sep 2, 2022 • 1h 14min

Creating a Python Code Completer & More Abstract Syntax Tree Projects

How does a code completion tool work? What is an Abstract Syntax Tree, and how is it created in Python? How does an AST help you write programs and projects that inspect and modify your Python code? This week on the show, Meredydd Luff, co-founder of Anvil, shares his PyCon talk, “Building a Python Code Completer.” Meredydd talks about his experience building a code completion engine for the Anvil platform. The conversation leads us to discuss how Python parses the code that you type. We examine tokenization, abstract syntax trees, and how parsing has changed in Python. We cover additional projects that you can explore once you have a tool that inspects the Python code you’re writing. Join us as we dive into multiple rabbit holes of research and exploration. Course Spotlight: Python Assignment Expressions and Using the Walrus Operator In this course, you’ll learn about assignment expressions and the walrus operator. The biggest change in Python 3.8 was the inclusion of the := operator, which you can use to assign variables in the middle of expressions. You’ll see several examples of how to take advantage of this feature. Topics: 00:00:00 – Introduction 00:02:11 – Building a Python Code Completer - Talk 00:08:48 – How is recursion being used? 00:10:28 – Abstract Syntax Trees, Parsers, and Tokens 00:14:58 – Sponsor: CData Software 00:15:39 – Is parsing into tokens a separate step? 00:21:45 – What makes the new PEG parser unique? 00:25:32 – Using the AST doesn’t have to be scary. 00:27:33 – More on the PEG parser 00:29:54 – Keeping scope and holding completions 00:39:43 – Video Course Spotlight 00:41:15 – Was this your first expirement in creating a code completer? 00:46:46 – How can adding type hints assist a completer? 00:50:53 – Projects you can build using AST 00:53:02 – Linter project 00:54:15 – Automatic code formatter 00:54:59 – Code testing and the pytest project 00:56:22 – Security tools 00:57:11 – Friendlier tracebacks 00:59:57 – Code completion vs GitHub Copilot 01:04:14 – Code completion in a text editor vs IDE 01:08:53 – What are you excited about in the world of Python? 01:09:54 – What do you want to learn next? 01:11:20 – How can people follow your work? 01:12:31 – Thanks and goodbye Show Links: Talk - Meredydd Luff: Building a Python Code Completer - YouTube Anvil | Build Web Apps with Nothing but Python Episode #63: Create Web Applications Using Only Python With Anvil – The Real Python Podcast “Writing a PEG parser for fun and profit” - Guido van Rossum (North Bay Python 2019) - YouTube PEG Parsing Series Overview. My series of blog posts about PEG | by Guido van Rossum Abstract syntax tree - Wikipedia Parse tree - Wikipedia ast — Abstract Syntax Trees — Python 3.10.6 documentation Full Grammar specification — Python 3.10.6 documentation Python AST Explorer Examples of working with ASTs — Green Tree Snakes 1.0 documentation bellybutton: Custom Python linting through AST expressions black · PyPI pytest: helps you write better programs — pytest documentation friendly-traceback: Friendlier Python tracebacks. Raspberry Pi Pico – Raspberry Pi Raspberry Pi Pico W : ID 5526 : $6.00 : Adafruit Industries, Unique & fun DIY electronics and kits State management - Wikipedia Recoil Meredydd Luff (@meredydd) / Twitter Level up your Python skills with our expert-led courses: Python Assignment Expressions and Using the Walrus Operator Testing Your Code With pytest Writing Beautiful Pythonic Code With PEP 8 Support the podcast & join our community of Pythonistas
undefined
37 snips
Aug 19, 2022 • 1h 2min

Configuring a Coding Environment on Windows & Using TOML With Python

Have you attempted to set up a Python development environment on Windows before? Would it be helpful to have an easy-to-follow guide to get you started? 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 tutorial that covers configuring a Windows coding environment. The guide contains valuable suggestions, best practices, and powerful coding tools. It also covers how to use a package manager, the new Windows Terminal, PowerShell Core, and a program to manage multiple versions of Python. Christopher covers another Real Python tutorial about using TOML in Python. TOML is a configuration format for building and distributing your own packages. We discuss how TOML parsing will be added to Python’s standard library in version 3.11. We cover several other articles and projects from the Python community, on topics including technical writing for developers, a news round-up, a farewell to obsolete Python libraries, uncommon uses of Python in commonly used libraries, a prettier ls, and a project for advanced hot reloading in Python. Course Spotlight: Python Basics: Finding and Fixing Code Bugs In this Python Basics video course, you’ll learn how to identify and fix logic errors, or bugs, in your Python code. You’ll use the built-in debugging tools in Python’s Integrated Development and Learning Environment to practice locating and resolving bugs in an example function. Topics: 00:00:00 – Introduction 00:02:13 – Python 3.10.6 Released 00:02:41 – Python 3.11.0rc1 Released 00:03:13 – Django 4.1 Released 00:04:07 – 10 malicious Python packages exposed in latest repository attack 00:05:12 – Protestware: Why Developers Sabotage Their Own Code 00:06:41 – Python and TOML: New Best Friends 00:16:19 – Say Goodbye to These Obsolete Python Libraries 00:25:51 – Video Course Spotlight 00:27:26 – Uncommon Uses of Python in Commonly Used Libraries 00:37:56 – Your Python Coding Environment on Windows: Setup Guide 00:48:20 – Technical Writing for Developers 00:55:24 – reloadium: Advanced Hot Reloading for Python 00:58:07 – pls: A Prettier ‘ls’ 01:00:56 – Thanks and goodbye News: Python 3.10.6 Released Python 3.11.0rc1 Released Django 4.1 Released 10 malicious Python packages exposed in latest repository attack | Ars Technica Protestware: Why Developers Sabotage Their Own Code Topic Links: Python and TOML: New Best Friends – TOML is a configuration file format that’s becoming increasingly popular in the Python community. In this tutorial, you’ll learn the syntax of TOML and explore how you can work with TOML files in your own projects. Say Goodbye to These Obsolete Python Libraries – It’s time to say goodbye to os.path, random, pytz, namedtuple and many more obsolete Python libraries. Start using the latest and greatest ones instead. Uncommon Uses of Python in Commonly Used Libraries – To learn more about writing maintainable Python, Eugene has been reading code from some of the more popular Python libraries. This blog post talks about some of the coding patterns he has encountered along the way. Your Python Coding Environment on Windows: Setup Guide – With this opinionated guide to setting up a basic, fully featured, and flexible setup for Python coding and contributing to open-source projects when working from Windows, you’ll go from a fresh install to ready to contribute, and even check out a PowerShell script to automate much of the process. Discussion: Technical Writing for Developers – “The way we write about and around code is arguably as important as the code itself.” This article outlines how programming and writing come together to take your developer skills to the next level. Projects: reloadium: Advanced Hot Reloading for Python pls: A Prettier ‘ls’ Additional Links: Python 3.11 Preview: TOML and tomllib – Real Python Why you should be using pathlib No really, pathlib is great Episode #116: Exploring Functional Programming in Python With Bruce Eckel – The Real Python Podcast Episode #101: Tools for Setting Up Python on a New Machine – The Real Python Podcast pls: Documentation Level up your Python skills with our expert-led courses: Python Basics: Finding and Fixing Code Bugs Practical Recipes for Working With Files in Python Debugging in Python With pdb Support the podcast & join our community of Pythonistas

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app