What is this pattern about? The Pipeline design pattern (also known as Chain of Command pattern) is a flexible way to handle a sequence of actions, where each handler in the chain processes the input data and passes it to the next handler. This pattern is commonly used in scenarios involving data processing, web scraping,… Continue reading A Practical Example of the Pipeline Pattern in Python
Articles on typing
Leveraging typing.Protocol: Faster Error Detection And Beyond Inheritance
By Bob Belderbos on 9 February 2024
Introduction Two weeks ago I wrote an article about ABCs and interface enforcement. Shortly after I learned that you can do this as well with protocols. Python 3.8 introduced quite a groundbreaking feature that further advanced the language’s capabilities in type checking: the typing.Protocol which allows Python developers to define and enforce interface contracts in… Continue reading Leveraging typing.Protocol: Faster Error Detection And Beyond Inheritance
Annotate all the things! Why you should care about Python type hints …
By PyBites Team on 16 August 2022
Listen now: This week we have Will Frey on the podcast: ML engineer, Python “knowledge dictionary” and type hints fan & geek. We talk about his background, how he learns / keeps up with Python’s fast moving ecosystem and of course we look at Python’s type hints in-depth: why care and some of his favorite tricks. We… Continue reading Annotate all the things! Why you should care about Python type hints …
Documentation-driven development with Sebastián Ramirez
By PyBites Team on 28 July 2022
Listen here: This week Bob and Pybites Coach, Robin Beer, interview Sebastián Ramirez, the creator of FastAPI, Typer and SQLModel. We talk about:– What he is currently working on.– How to balance the large amount of opportunities in his space (open source developer productivity tips).– The process of designing new libraries that are the glue between other ones.– The feeling of… Continue reading Documentation-driven development with Sebastián Ramirez
Learning Rich by making a color searcher command line app
By Bob Belderbos on 6 July 2022
The other day I wanted to get serious with the awesome Rich library. As we always say: you have to build to really learn + need ideas? Scratch your own itch. If you’re struggling for ideas, see what takes you long and/or is cumbersome and see if it’s a good candidate to automate it with… Continue reading Learning Rich by making a color searcher command line app
Code Better with Type Hints – Part 3
By Michael Aydinbas on 8 April 2022
This is the third part of a series of articles dealing with the type annotation system in Python, type hints for short. The second part discussed a set of beginner examples and highlighted the benefits of using type hints. This article series is aimed at newcomers to type hints and wants to help you get… Continue reading Code Better with Type Hints – Part 3
Code Better with Type Hints – Part 2
By Michael Aydinbas on 27 August 2021
This is the second part of a series of articles dealing with the type annotation system in Python, type hints for short. The first part gave an introduction to type hints. This article is aimed at newcomers to type hints and wants to help you get started. In this second part, I will go over… Continue reading Code Better with Type Hints – Part 2
Code Better with Type Hints – Part 1
By Michael Aydinbas on 12 August 2021
This is the first part of a series of articles dealing with the type annotation system in Python, type hints for short. With this opinionated article, I advocate the use of type hints. I want to explain why you should care and why your code will be better, more bug-free, more accessible, and easier to… Continue reading Code Better with Type Hints – Part 1
Naughts and Crosses Gets a Little Help
By Geoff Riley on 12 March 2021
Naughts and Crosses (Tic-Tac-Toe to some audiences) is a popular skill game often played by children. It can also be usefully employed to distract dial up computers, at NORAD for example, rather than allowing the ‘playing’ of Global Thermonuclear War. Would you like to play a game?
Abstract Syntax Trees in Python
By Alessandro Finamore on 20 February 2021
In this article Alessandro provides an overview of Abstract Syntax Trees (ASTs), introduces a few use-cases, and showcases the ast module in the Python Standard Library. The content is structured in a top-down fashion, starting from general notion about an AST, and digging deeper up to the point of artificially manipulating an AST to “randomize” the content of some instructions.