Context Managers and the “with” Statement in Python
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.
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.
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.
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.
This is the second episode of my video code review series where I record myself giving feedback and refactoring a reader’s Python code.
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!
Sublime Text comes with a handy command line tool (“subl”) that lets you control Sublime Text from the terminal. In this 3 minute screencast I’ll show you how to setup the command and what you can do with it.
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.
A quick video that demonstrates bpython, an awesome alternative Python interpreter.
A quick screencast that shows you how to use Sublime Text as your Git editor. Super useful if you work with Git from the command line!
Context Managers and the “with” Statement in Python
Comprehending Python’s Comprehensions
Python Code Review: Unplugged – Episode 3
Click & jump to any file or folder from the terminal
Python Code Review: Unplugged – Episode 2
Using get() to return a default value from a Python dict
Watch me do a “live” Python code review for a reader
How to use Sublime Text from the command line
Make your Python code more readable with custom exception classes
A better Python REPL: bpython vs python
Using Sublime Text as your Git editor
Some of the best content I post is email only. Join over 18,144 other Python developers on my (free) weekly newsletter →
📰 Learn More »