A question came up recently about the purpose of the Python yield expression and when you should use it. Consider this silly function that computes a list of integers from 0 to 99 raised to the given exponent: When called, this function runs thru all 100 integers in the range computing each term and then returns the… Continue reading What The Heck Is Yield For?
Articles on performance
Make Each Line Count, Keeping Things Simple in Python
By Bob Belderbos on 24 August 2023
A challenge in software development is to keep things simple 🤯 For your code to not grow overly complex over time 😱 Simple is better than complex.Complex is better than complicated. Zen of Python 🐍 Simplicity in your code means fewer possibilities for bugs to hide and easier debugging when they do arise 📈 It… Continue reading Make Each Line Count, Keeping Things Simple in Python
How to create a self updating GitHub Readme
By Bob Belderbos on 21 November 2022
It was about time to give my GitHub profile a nice intro so inspired by Simon Willison’s blog post I decided to make an intro Readme that auto-updates. First I made a GitHub repo called bbelderbos, my username. That’s how it works: GitHub defaults to showing the Readme.md of your username’s repo on your profile page.… Continue reading How to create a self updating GitHub Readme
A Case Study in Refactoring Python: Clean Code Is Often Faster
By Russell Helmstedter on 20 July 2022
I have learned a lot over the past 2.5 years of my Python journey. What started out as a hobby during COVID-19 lock downs in 2020, has now become a major component of my professional workload. This article is designed to highlight the importance of the iterative process: write some code -> learn new stuff… Continue reading A Case Study in Refactoring Python: Clean Code Is Often Faster
What Can You Do Consistently This Week?
By Bob Belderbos on 2 March 2020
Last week I learned about lagging and leading indicators and why it’s important to focus on the latter.
5 tips to speed up your Python code
By Bob Belderbos on 21 February 2017
In this post I will give you 5 tips to speed up your code.
A great book that makes algorithms accessible
By Bob Belderbos on 3 January 2017
I finished reading Grokking Algorithms, it’s a very accessible resource for learning algorithms / data structures, highly recommended.
Read the stdlib: deque
By Bob Belderbos on 20 December 2016
Use collections.deque to rotate letters in string (or elements in list). It has a native method which performs faster too.