Good Python Programming Practices When New to the Language
Description
What advice would you give to someone moving from another language to Python? What good programming practices are inherent to the language? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder’s Weekly articles and projects.
We discuss an older forum post from a new Python user who came from Perl. We suggest checking out PEP 8, or as it’s commonly known, “The Style Guide for Python Code.” We provide advice about installing Python, avoiding common pitfalls, learning how scope is managed, and taking advantage of a collection of Real Python resources.
We share several other articles and projects from the Python community, including a new Python release, practical NumPy examples and exercises, considering targets of for loops, exploring Python dependency management, checking package compatibility with free-threading and subinterpreters, an experimental filesystem navigator in Textual, and a background workers reference implementation in Django.
This episode is sponsored by AssemblyAI.
Course Spotlight: Writing Beautiful Pythonic Code With PEP 8
Learn how to write high-quality, readable code by using the Python style guidelines laid out in PEP 8. Following these guidelines helps you make a great impression when sharing your work with potential employers and collaborators. This course outlines the key guidelines laid out in PEP 8. It’s aimed at beginner to intermediate programmers.
Topics:
- 00:00:00 – Introduction
- 00:02:17 – Python 3.14.0 Alpha 2 Released
- 00:02:35 – Take the 2024 Django Developers Survey
- 00:03:17 – NumPy Practical Examples: Useful Techniques
- 00:07:09 – Loop Targets
- 00:09:19 – Python Dependency Management Is a Dumpster Fire
- 00:23:15 – Sponsor: AssemblyAI
- 00:24:00 – Package Compatibility With Free-Threading and Subinterpreters
- 00:27:02 – Suggestions for good programming practices?
- 00:37:59 – Video Course Spotlight
- 00:39:24 – terminal-tree: Experimental Filesystem Navigator in Textual
- 00:43:56 – django-tasks: Background Workers Reference Implementation
- 00:49:44 – Thanks and goodbye
News:
Topics:
- NumPy Practical Examples: Useful Techniques – In this tutorial, you’ll learn how to use NumPy by exploring several interesting examples. You’ll read data from a file into an array and analyze structured arrays to perform a reconciliation. You’ll also learn how to quickly chart an analysis and turn a custom function into a vectorized function.
- Loop Targets – Loop assignment allows you to assign to a dict item in a
for
loop. This post covers what that means and that it is no more costly than regular assignment. - Python Dependency Management Is a Dumpster Fire – Managing dependencies in Python can be a bit of a challenge. This deep dive article shows you all the problems and how the problems are mitigated if not solved.
- Package Compatibility With Free-Threading and Subinterpreters – This tracker tests the compatibility of the 500 most popular packages with Python 3.13’s free-threading and subinterpreter features.
Discussion:
- Suggestions for good programming practices?
- Python Best Practices – Real Python
- PEP 8 – Style Guide for Python Code
Projects:
- terminal-tree: Experimental Filesystem Navigator in Textual
- django-tasks: Background Workers Reference Implementation
Additional Links:
- Episode #146: Using NumPy and Linear Algebra for Faster Python Code – The Real Python Podcast
- How to Write Beautiful Python Code With PEP 8 – Real Python
- Writing Idiomatic Python – Real Python
- Namespaces and Scope in Python – Real Python
- How to Install Python on Your System: A Guide – Real Python
- Python Virtual Environments: A Primer – Real Python
- Sourcery - Instant Code Review for Faster Velocity
- Episode #183: Exploring Code Reviews in Python and Automating the Process
- Textual
- uv - An extremely fast Python package and project manager, written in Rust.
- DEP 0014: Background workers - GitHub
- PyCoder’s Weekly - Have a Project You Want to Share? - Submit a Link
Level up your Python skills with our expert-led courses: