Iterator Chains as Pythonic Data Processing Pipelines
Here’s another great feature of iterators in Python: By chaining together multiple iterators you can write highly efficient data processing “pipelines.”
Here’s another great feature of iterators in Python: By chaining together multiple iterators you can write highly efficient data processing “pipelines.”
An end-to-end tutorial of how to extend your Python programs with libraries written in C, using the built-in “ctypes” module.
Generator expressions are a high-performance, memory–efficient generalization of list comprehensions and generators. In this tutorial you’ll learn how to use them from the ground up.
Generators are a tricky subject in Python. With this tutorial you’ll make the leap from class-based iterators to using generator functions and the “yield” statement in no time.
A tutorial on Python’s advanced data unpacking features: How to unpack data with the “=” operator and for-loops.
How and why to implement Python “to string” conversion in your own classes using Python’s “repr” and “str” mechanisms and associated coding conventions.
Understanding iterators is a milestone for any serious Pythonista. With this step-by-step tutorial you’ll understanding class-based iterators in Python, completely from scratch.
A step-by-step introduction to basic Python package management skills with the “pip” command. Learn how to install and remove third-party modules from PyPI.
A tutorial on how to find out whether a file (or directory) exists using Python built-ins and functions from the standard library.
A step-by-step tutorial on the three main ways to reverse a Python list or array: in-place reversal, list slicing, and reverse iteration.
How to implement arrays in Python using only built-in data types and classes from the standard library. Includes code examples and recommendations.
Learn how to implement a linked list data structure in Python, using only built-in data types and functionality from the standard library.
What Python’s “magic methods” are and how you would use them to make a simple account class more Pythonic.
How to use Python to write asynchronous programs, and why you’d want to do such a thing.
Ever introduced code reviews to an existing Python code base? It can be awesome, or pure hell…
A couple of years ago I’d become quite interested in martial arts. Hours upon hours of watching “The Karate Kid” growing up must’ve taken their toll on me…
How to implement records, structs, and “plain old data objects” in Python using only built-in data types and classes from the standard library.
An introduction to the ipaddress module available on Python 3.3+ for manipulation of IPv4 and IPv6 addresses.
A “minimalist guide” on how to prepare for your upcoming Python interview in three steps.
I’ll never forget launching my first open-source project and sharing it publicly on Reddit…
The various meanings and naming conventions around single and double underscores (“dunder”) in Python, how name mangling works and how it affects your own Python classes.
What is the Python programming language used for in the real world, and when is using Python the right choice?
How to implement a stack data structure (LIFO) in Python using built-in types and classes from the standard library.
In the fourth (and final) class in this series you’ll learn how to make your Python programs interactive by letting them react to user input.
Introducing PythonistaCafe—an invite-only, online community of Python and software development enthusiasts helping each other succeed and grow.
In part three of this four-part Python introduction you’ll see how to teach your program how to make decisions with conditionals and if-statements.
How to implement a FIFO queue data structure in Python using only built-in data types and classes from the standard library.
In part two of this four-part Python introduction you’ll see how to write reusable “code building blocks” in your Python programs with functions.
How to implement mutable and immutable set and multiset (bag) data structures in Python using built-in data types and classes from the standard library.
In this four-part introduction for new programmers you’ll learn the basics of programming with Python using step-by-step descriptions and graphical examples.
Need a dictionary, map, or hash table to implement an algorithm in your Python program? Read on to see how the Python standard library can help you.
What are the various ways you can implement a priority queue in Python? Read on and find out what the Python standard library has to offer.
In this article series we’ll take a tour of some fundamental data structures and implementations of abstract data types (ADTs) available in Python’s standard library.
Understanding decorators is a milestone for any serious Python programmer. Here’s your step-by-step guide to how decorators can help you become a more efficient and productive Python developer.
PyPI, the Python packaging repository, just crossed 100,000 third-party packages in total the other week. That’s an overwhelming number of packages to choose from.
Python’s functions are first-class objects. You can assign them to variables, store them in data structures, pass them as arguments to other functions, and even return them as values from other functions.
Pythonize your C-style “for” and “while” loops by refactoring them using generators and other techniques.
I struggled with setting up an effective development environment as a new Python developer. It was difficult to build the right habits and to find a set of tools I enjoyed to use.
The “with” statement in Python is regarded as an obscure feature by some. But when you peek behind the scenes of the underlying Context Manager protocol you’ll see there’s little “magic” involved.
In this tutorial you’ll learn how to set up Python and the Pip package manager on Windows 10, completely from scratch.
How to write beautiful and clean Python by tweaking your Sublime Text settings so that they make it easier to adhere to the PEP 8 style guide recommendations.
Python comes with a specialized “namedtuple” container type that doesn’t seem to get the attention it deserves. It’s one of these amazing features in Python that’s hidden in plain sight.
An introduction to “lambda” expressions in Python: What they’re good for, when you should use them, and when it’s best to avoid them.
Is Python worth learning? We’ve interviewed experts and surveyed the job market to identify the key reasons why you should learn Python today.
Remember the Zen of Python and how there should be “one obvious way to do something in Python”? You might scratch your head when you find out that there are *four* major ways to do string formatting in Python.
How to use assertions to help automatically detect errors in your Python programs in order to make them more reliable and easier to debug.
One of my favorite features in Python are list comprehensions. They can seem a bit arcane at first but when you break them down they are actually a very simple construct.
Python has two operators for equality comparisons, “is” and “==” (equals). In this article I’m going to teach you the difference between the two and when to use each with a few simple examples.
My tutorial on how you can get a first-time speaking gig at a tech conference like PyCon as a software developer.
Python 3.6 adds a couple of new features and improvements that’ll affect the day to day work of Python coders. In this article I’ll give you an overview of the new features I found the most interesting.
One of the best things I ever did for my dev career: A little story and three reasons why you should start a programming portfolio website right now.
Let’s pry apart this slightly unintuitive Python dictionary expression to find out what’s going on in the uncharted depths of the Python interpreter.
I couldn’t find a good and updated list of Python developer or Python programming podcasts online. So I created my own list with the best Python podcasts.
In Python code reviews I’ve seen over and over that it can be tough for developers to format their Python code in a consistent way: extra whitespace, irregular indentation, and other “sloppiness” then often leads to actual bugs in the program.
Ever witnessed a colleague make a refactoring to “clean up” some Python code only to make it worse and harder to understand?
In this third episode of my video code review series I take a look at a reader’s web scraping project and start adding some unit tests to it.
iTerm2 for macOS has a little known feature that lets you open files and folders simply by Cmd+Clicking on them in the terminal. Among other things, this is super handy for debugging tests.
A review of Djaneiro, a Sublime Text plugin for Django development.
Hey folks, I’m super excited to announce the launch of my first book – It’s called “The Complete Guide to Setting up Sublime Text for Python Developers”.
This is the second episode of my video code review series where I record myself giving feedback and refactoring a reader’s Python code.
The Python script you just wrote would make a great little command line tool – but having to type “python myscript.py” all the time to launch your program gets daunting fast. Here’s how you can make your Python script feel like a real shell command.
Python’s dictionaries have a “get” method to look up a key while providing a fallback value. This short screencast tutorial gives you a real-world example where this might come in handy.
This is a bit of an experiment – but you might find it interesting!
Recommendations for intermediate-level Python books that help you get past the basics so you can start working on small projects.
In this short screencast I’ll walk you through a simple code example that demonstrates how you can use custom exception classes in your Python code to make it easier to understand, easier to debug, and more maintainable.
When you ask for editor recommendations as a Python developer one of the top choices you’ll hear about is Sublime Text. In this post I’ll review the status of Python development with Sublime Text as of 2016.
Let’s talk about using Python’s min and max functions on a list containing other lists. Sometimes this is referred to as a nested list or a lists of lists.
A quick video that demonstrates bpython, an awesome alternative Python interpreter.
Maybe you’ve been using Python for a while now and you’re starting to feel like you’re getting the hang of it. But one day you catch yourself thinking: “What about classes?”
“How do I parse an ISO 8601 formatted date in Django without bringing in extra dependencies?”
It’s easy to accidentally write Python assert statements that always evaluate to true. Here’s how to avoid this mistake and catch bad assertions as part of your continuous integration build.
How to generate documentation for a RESTful API as part of your continuous integration build and then automatically deploy it to a website. Includes a full example project on GitHub.
When you make an HTTP OPTIONS request against an endpoint in a Django Rest Framework app you might be surprised about what you’ll find in the response to that request.
I worked on a Python web app a while ago that was struggling with using too much memory in production. A helpful technique for debugging this issue was adding a simple API endpoint that exposed memory stats while the app was running.
I’ve been burned by relying 100% on a cloud service before. Some time ago a photographer friend convinced me to sign up for an awesome photo storage service called Everpix.
This article shows you how to use the pytest-osxnotify, a plugin for pytest that adds native Mac OS X notifications to the pytest terminal runner.
Reading books is one of the best ways to improve your craftsmanship and to become a better software developer. This is a continuously updated list with my favourite programming books, sorted by topic. I link to the ebook version where possible but most books should be available made from dead trees as well.
Abstract Base Classes (ABCs) ensure that derived classes implement particular methods from the base class. In this tutorial you’ll learn about the benefits of abstract base classes and how to define them with Python’s built-in abc module.
Linked lists are fundamental data structures that every programmer should know. This article explains how to implement a simple linked list data type in Python using a functional programming style.
I recently started using Sublime Text 2 more and more as my main editor for Python development. This article explains my setup and some tweaks that make Python programmers happy.
For my Raspberry Pi internet radio project I needed a way to render text suitable for a low resolution monochrome LCD. This article describes how to render 1-bit text using FreeType and Python.
I wrote a countdown timer extension for the Alfred application launcher for OS X. The extension is open-source, written in Python and uses Mountain Lion’s user notifications.
Iterator Chains as Pythonic Data Processing Pipelines
Extending Python With C Libraries and the “ctypes” Module
Generator Expressions in Python: An Introduction
What Are Python Generators?
Unpacking Nested Data Structures in Python
Python String Conversion 101: Why Every Class Needs a “repr”
Python Iterators: A Step-By-Step Introduction
How to Install and Uninstall Python Packages Using Pip
How to Check if a File Exists in Python
How to Reverse a List in Python
Array Data Structures in Python
Linked Lists in Python
Enriching Your Python Classes With Dunder (Magic, Special) Methods
Understanding Asynchronous Programming in Python
How to Speed Up Python Code Reviews With Linting
A Story About Python Mastery
Records, Structs, and Data Transfer Objects in Python
An Overview of Python’s “ipaddress” Module
How to Prepare for a Python Coding Interview
In Love, War, and Open-Source: Never Give Up
The Meaning of Underscores in Python
When to Use Python
Stacks in Python
Let’s Program with Python: Reacting to User Input (Part 4)
PythonistaCafe: A Peer-to-Peer Learning Community for Python Developers
Let’s Program with Python: Conditionals and “if” Statements (Part 3)
Queues in Python
Let’s Program with Python: Functions and Lists (Part 2)
Sets and Multisets in Python
Let’s Program with Python: Statements, Variables, and Loops (Part 1)
Dictionaries, Maps, and Hash Tables in Python
Priority Queues in Python
Fundamental Data Structures in Python
Python Decorators: A Step-By-Step Introduction
Finding and Choosing Quality Python Packages
Python’s Functions Are First-Class
How to Make Your Python Loops More Pythonic
5 Python Development Setup Tips to Boost Your Productivity
Context Managers and the “with” Statement in Python
Installing Python and Pip on Windows
Sublime Text Settings for Writing Clean Python
Writing Clean Python With Namedtuples
Lambda Functions in Python: What Are They Good For?
Why Learn Python? Here Are 8 Data-Driven Reasons
The 4 Major Ways to Do String Formatting in Python
Assert Statements in Python
Comprehending Python’s Comprehensions
The Difference Between “is” and “==” in Python
How to Speak at a Python Conference
Cool new features in Python 3.6
3 Reasons why you need a programming blog
A Python Riddle: The Craziest Dict Expression in the West
The Ultimate List of Python Podcasts
How code linting will make you awesome at Python
A Python refactoring gone wrong
Python Code Review: Unplugged – Episode 3
Click & jump to any file or folder from the terminal
Sublime Text plugin review: Djaneiro
The Complete Guide to Setting up Sublime Text for Python Developers – Now Available!
Python Code Review: Unplugged – Episode 2
How do I make my own command line commands using Python?
Using get() to return a default value from a Python dict
Watch me do a “live” Python code review for a reader
What books should I read to move past the beginner stage in Python?
Make your Python code more readable with custom exception classes
Sublime Text for Python development — My 2016 review
How to use Python’s min() and max() with nested lists
A better Python REPL: bpython vs python
6 things you’re missing out on by never using classes in your Python code
Parsing ISO 8601 timestamps in plain Django
Catching bogus Python asserts on CI
Generate and host your API documentation for free with open-source tools
How to stop Django Rest Framework from leaking docstrings into OPTIONS responses
Debugging memory usage in a live Python web app
How to store photos in the cloud and avoid vendor lock-in
OS X notifications for your pytest runs
Software engineer reading list: My favourite books about programming
Abstract Base Classes in Python
Functional linked lists in Python
Setting up Sublime Text for Python development
Monochrome font rendering with FreeType and Python
A countdown timer extension for Alfred
Some of the best content I post is email only. Join over 18,144 other Python developers on my (free) weekly newsletter →
📰 Learn More »